MCPcopy
hub / github.com/hwholiday/learning_tools / NewWsConnection

Function NewWsConnection

istio/gateway/ws_conn.go:27–38  ·  view source on GitHub ↗
(conn *websocket.Conn)

Source from the content-addressed store, hash-verified

25)
26
27func NewWsConnection(conn *websocket.Conn) *WsConnection {
28 ws := &WsConnection{}
29 ws.ws = conn
30 ws.readChan = make(chan []byte, 10)
31 ws.writeChan = make(chan []byte, 10)
32 ws.closeChan = make(chan bool)
33 ws.isOpen = true
34 ws.connId = uuid.NewV5(uuid.NewV4(), "ws").String()
35 go ws.read()
36 go ws.send()
37 return ws
38}
39func (w *WsConnection) SetIp(ip string) {
40 w.clientIp = ip
41}

Callers 1

getConnFunction · 0.70

Calls 3

readMethod · 0.95
sendMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected