mirror of https://github.com/gorilla/websocket.git
Reduce memory used in chat example
This commit is contained in:
parent
a91eba7f97
commit
ea4d1f681b
|
@ -129,6 +129,9 @@ func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
client := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}
|
client := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}
|
||||||
client.hub.register <- client
|
client.hub.register <- client
|
||||||
|
|
||||||
|
// Allow collection of memory referenced by the caller by doing all work in
|
||||||
|
// new goroutines.
|
||||||
go client.writePump()
|
go client.writePump()
|
||||||
client.readPump()
|
go client.readPump()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue