func main() { conf := sockjs.NewConfig() sockjshandler := sockjs.NewHandler("/chat", chatHandler, conf) beego.Router("/", &MainController{}) beego.RouterHandler("/chat/:info(.*)", sockjshandler) beego.Run() }
func main() { beego.Router("/", &controllers.MainController{}) beego.Router("/home", &controllers.MainController{}) beego.Router("/login", &controllers.LoginRouter{}) beego.Router("/register", &controllers.RegisterRouter{}) beego.Router("/forget", &controllers.ForgetRouter{}) beego.Router("/reset", &controllers.ResetRouter{}) beego.Router("/football", &controllers.FootballRouter{}) beego.Router("/basketball", &controllers.BasketballRouter{}) beego.Router("/game/:id:int", &controllers.GameRouter{}) // About beego.Router("/about", &controllers.AboutRouter{}) // Chat beego.Router("/chat", &controllers.ChatRouter{}) beego.RouterHandler("/chat/:info(.*)", controllers.SockjsHandler) // Withdraw beego.Router("/withdraw", &controllers.WithdrawRouter{}) // Userinfo beego.Router("/user", &controllers.UserRouter{}) beego.Router("/user/:all", &controllers.UserRouter{}) // Admin beego.Router("/admin", &controllers.AdminRouter{}) beego.Router("/admin/:all", &controllers.AdminRouter{}) // 404 beego.Router("/:all", &controllers.ErrorRouter{}) beego.Run() }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) conf := sockjs.NewConfig() pool := sockjs.NewSessionPool() dev := controllers.NewDevice(pool, 10) dev.AddReader("/dev/dp0/s02_roten/count") dev.AddReader("/dev/dp0/s04_slider4/updates") sockjshandler := sockjs.NewHandler("/socket", dev.SocketHandler, conf) dc := controllers.DemandController{} beego.Router("/", &dc) beego.Router("/test", &controllers.ChatController{}) beego.RouterHandler("/socket/:info(.*)", sockjshandler) beego.Run() }