[Examples\Chat] Allow to free HTTP conn things

This commit is contained in:
Dmitry Patsura 2017-06-14 15:14:14 +09:00 committed by GitHub
parent a91eba7f97
commit 55a83f0ee3
1 changed files with 4 additions and 1 deletions

View File

@ -127,8 +127,11 @@ func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {
log.Println(err)
return
}
client := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}
client.hub.register <- client
// exit from serveWs, now HTTP server can free unneeded things
go client.writePump()
client.readPump()
go client.readPump()
}