MCPcopy Create free account
hub / github.com/dgrr/http2 / OnPong

Method OnPong

demo/main.go:155–171  ·  view source on GitHub ↗
(c *websocket.Conn, data []byte)

Source from the content-addressed store, hash-verified

153}
154
155func (ws *WebSocketService) OnPong(c *websocket.Conn, data []byte) {
156 if len(data) != 8 {
157 return
158 }
159
160 ts := time.Now().Sub(
161 time.Unix(0, int64(
162 binary.BigEndian.Uint64(data))),
163 )
164
165 data, _ = json.Marshal(
166 rttMessage{
167 RTTInMs: ts.Milliseconds(),
168 })
169
170 c.Write(data)
171}
172
173func (ws *WebSocketService) Run() {
174 time.AfterFunc(time.Millisecond*500, func() {

Callers

nothing calls this directly

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected