update sample main
This commit is contained in:
parent
3be3b5e156
commit
2bb8b81a21
|
@ -15,21 +15,23 @@ func main(){
|
||||||
serv := ws.CreateServer("0.0.0.0", 4444)
|
serv := ws.CreateServer("0.0.0.0", 4444)
|
||||||
|
|
||||||
/* (2) Bind default controller */
|
/* (2) Bind default controller */
|
||||||
err := serv.BindDefault(func(c ws.Client, f ws.Frame){
|
err := serv.BindDefault(func(c *ws.Client, f *ws.Frame){
|
||||||
fmt.Printf("Default controller")
|
fmt.Printf("Default controller")
|
||||||
})
|
})
|
||||||
if err != nil { panic(err) }
|
if err != nil { panic(err) }
|
||||||
|
|
||||||
/* (3) Bind to URI */
|
/* (3) Bind to URI */
|
||||||
err = serv.Bind("/channel/./room/./", func(c ws.Client, f ws.Frame){
|
err = serv.Bind("/channel/./room/./", func(c *ws.Client, f *ws.Frame){
|
||||||
fmt.Printf("URI controller")
|
fmt.Printf("URI controller")
|
||||||
})
|
})
|
||||||
if err != nil { panic(err) }
|
if err != nil { panic(err) }
|
||||||
|
|
||||||
/* (4) Launch the server */
|
/* (4) Launch the server */
|
||||||
serv.Launch()
|
err = serv.Launch()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("[ERROR] %s\n", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fmt.Printf("+ elapsed: %1.1f us\n", float32(time.Now().UnixNano()-startTime)/1e3)
|
fmt.Printf("+ elapsed: %1.1f us\n", float32(time.Now().UnixNano()-startTime)/1e3)
|
||||||
|
|
Loading…
Reference in New Issue