add close case (payload size = 0)

This commit is contained in:
xdrm-brackets 2018-05-02 23:47:00 +02:00
parent 0ed39dec0e
commit 09b3cc8921
1 changed files with 3 additions and 0 deletions

View File

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