diff --git a/ws/client/public.go b/ws/client/public.go index bb21003..0505667 100644 --- a/ws/client/public.go +++ b/ws/client/public.go @@ -118,6 +118,8 @@ func (c *T) reader(unregister chan <-*T){ // fmt.Printf(" [reader] sent PONG back\n") continue + } else if msg.Size == 0 && ( msg.Type == message.TEXT || msg.Type == message.BINARY ) { + break } /* (3) Dispatch to receiver */ @@ -127,6 +129,7 @@ func (c *T) reader(unregister chan <-*T){ // return closing callback c.Ch.Close <- func(){ + unregister <- c }