diff --git a/cmd/iface/main.go b/cmd/iface/main.go index c4cf82e..bed2342 100644 --- a/cmd/iface/main.go +++ b/cmd/iface/main.go @@ -15,20 +15,26 @@ func main(){ serv := ws.CreateServer("0.0.0.0", 4444) /* (2) Bind default controller */ - err := serv.BindDefault(func(c *ws.Client, f *ws.Frame){ - fmt.Printf("Default controller\n") - if f != nil { - fmt.Printf("Received: '%s'\n", f.Buf) + err := serv.BindDefault(func(c *ws.Client, f chan *ws.Frame){ + + fmt.Printf("[default] connected\n") + for frame := range f { + fmt.Printf("[default] received '%s'\n", frame.Buf) } + fmt.Printf("[default] closed\n") + }) if err != nil { panic(err) } /* (3) Bind to URI */ - err = serv.Bind("/channel/./room/./", func(c *ws.Client, f *ws.Frame){ - fmt.Printf("URI controller\n") - if f != nil { - fmt.Printf("Received: '%s'\n", f.Buf) + err = serv.Bind("/channel/./room/./", func(c *ws.Client, f chan *ws.Frame){ + + fmt.Printf("[uri] connected\n") + for frame := range f { + fmt.Printf("[uri] received '%s'\n", frame.Buf) } + fmt.Printf("[uri] closed\n") + }) if err != nil { panic(err) }