overflow_service_websocket/main.go
crusader f49a711b5a ing
2017-07-13 21:01:28 +09:00

29 lines
516 B
Go

package main
import (
"net/http"
"git.loafle.net/overflow/overflow_service_websocket/protocol/jsonrpc"
"git.loafle.net/overflow/overflow_service_websocket/server"
)
var (
host = "localhost:8080"
)
func main() {
ws := server.New(server.Options{})
ws.RegistProtocol("jsonrpc", jsonrpc.NewHandler())
ws.OnConnection(func(c server.Client) {
c.OnDisconnect(func(Client) {
})
})
http.HandleFunc("/ws", ws.HTTPHandler())
// ws.OnConnection(handleWebsocketConnection)
http.ListenAndServe(host, nil)
}