MCPcopy
hub / github.com/gorilla/websocket / serveWs

Function serveWs

examples/chat/client.go:124–137  ·  view source on GitHub ↗

serveWs handles websocket requests from the peer.

(hub *Hub, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

122
123// serveWs handles websocket requests from the peer.
124func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {
125 conn, err := upgrader.Upgrade(w, r, nil)
126 if err != nil {
127 log.Println(err)
128 return
129 }
130 client := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}
131 client.hub.register <- client
132
133 // Allow collection of memory referenced by the caller by doing all work in
134 // new goroutines.
135 go client.writePump()
136 go client.readPump()
137}

Callers 1

mainFunction · 0.70

Calls 3

writePumpMethod · 0.95
readPumpMethod · 0.95
UpgradeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…