Beispiel #1
0
func Run() {
	// 开启最大核心数运行
	runtime.GOMAXPROCS(runtime.NumCPU())

	// 预绑定路由
	Router()
	// 开启websocket
	go func() {
		reporter.Println("[pholcus] websocket server Running on ", wsAddr)
		if err := http.ListenAndServe(wsAddr, nil); err != nil {
			reporter.Fatal("Websocket ListenAndServe: ", err)
		}
	}()
	// 开启websocket log
	go func() {
		reporter.Println("[pholcus] websocket log server Running on ", wslogAddr)
		if err := http.ListenAndServe(wslogAddr, nil); err != nil {
			reporter.Fatal("Websocket Log ListenAndServe: ", err)
		}
	}()
	// 开启http
	reporter.Println("[pholcus] http server Running on ", addr)
	err := http.ListenAndServe(addr, nil) //设置监听的端口
	if err != nil {
		reporter.Fatal("Http ListenAndServe: ", err)
	}
}
Beispiel #2
0
func Run() {
	// 开启最大核心数运行
	runtime.GOMAXPROCS(runtime.NumCPU())

	// 预绑定路由
	Router()
	// 监听端口
	reporter.Println("[pholcus] server Running on ", addr)
	err := http.ListenAndServe(addr, nil) //设置监听的端口
	if err != nil {
		reporter.Fatal("ListenAndServe: ", err)
	}
}
Beispiel #3
0
func Run() {
	// 预绑定路由
	Router()
	// 开启websocket
	go func() {
		reporter.Println("[pholcus] websocket server Running on ", wsport)
		if err := http.ListenAndServe(wsport, nil); err != nil {
			reporter.Fatal("Websocket ListenAndServe: ", err)
		}
	}()
	// 开启websocket log
	go func() {
		reporter.Println("[pholcus] websocket log server Running on ", wslogport)
		if err := http.ListenAndServe(wslogport, nil); err != nil {
			reporter.Fatal("Websocket Log ListenAndServe: ", err)
		}
	}()
	// 开启http
	reporter.Println("[pholcus] http server Running on ", webport)
	err := http.ListenAndServe(webport, nil) //设置监听的端口
	if err != nil {
		reporter.Fatal("Http ListenAndServe: ", err)
	}
}