From 55a83f0ee356879026dbfbfb821e4233026bc388 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Wed, 14 Jun 2017 15:14:14 +0900 Subject: [PATCH] [Examples\Chat] Allow to free HTTP conn things --- examples/chat/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/chat/client.go b/examples/chat/client.go index 2646847..eb37530 100644 --- a/examples/chat/client.go +++ b/examples/chat/client.go @@ -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() }