예제 #1
0
파일: router.go 프로젝트: black-tech/achat
func init() {
	beego.Router("/", &controllers.MainController{})
	beego.Router("/home", &controllers.MainController{})

	beego.Router("/info", &controllers.InfoController{})
	beego.Router("/chat", &controllers.ChatController{})

	beego.Handler("/chat_websocket", websocket.Handler(models.ChatroomServer))
	// beego.Router("/b", &controllers.BController{})
}
예제 #2
0
파일: router.go 프로젝트: black-tech/achat
func init() {

	ch := models.NewChatHome()
	ch.InitGlobal()
	// connid = 0

	beego.Handler("/ws_chat", websocket.Handler(models.ChatroomServer))

	beego.Router("/", &controllers.MainController{})
	beego.Router("/login", &controllers.LoginController{})
	beego.Router("/chat_home", &controllers.ChatController{})

	log.Println("Router init Over")
}
예제 #3
0
func (s *Server) Start() {
	// Start timeout loop here
	logger.Println("[Message] Idle player checker goroutine started")
	go s.TimeoutLoop()
	go g_game.CheckCreatures()

	// Open new socket listener
	logger.Println("Opening websocket server on :" + s.Port + "/puserver")

	logger.Println("Server ready to accept new connections")
	http.Handle("/puserver", websocket.Handler(ClientConnection))
	err := http.ListenAndServe(":"+s.Port, nil)
	if err != nil {
		panic("ListenAndServe: " + err.Error())
	}
}
예제 #4
0
func main() {
	flag.Parse()

	portStrings := strings.Split(*ports, ",")

	availableNodes = make(chan int, *numNodes)

	for i, port := range portStrings {
		hostMap[i] = "localhost:" + port
		reverseHostMap["localhost:"+port] = i
		availableNodes <- i
	}

	http.Handle("/echo", websocket.Handler(echoHandler))
	http.HandleFunc("/index", indexHandler)
	http.Handle("/", http.FileServer(http.Dir(".")))
	err := http.ListenAndServe("localhost:8999", nil) //hostMap[*nodeID], nil)
	if err != nil {
		panic("ListenAndServe: " + err.Error())
	}
}
예제 #5
0
파일: main.go 프로젝트: smscloud/smscloud
func main() {
	http.Handle("/", websocket.Handler(CounterServer))
	if err := http.ListenAndServe(":5603", nil); err != nil {
		log.Fatalln(err)
	}
}