MCPcopy Index your code
hub / github.com/gotify/server / startReading

Method startReading

api/stream/client.go:61–75  ·  view source on GitHub ↗

startWriteHandler starts listening on the client connection. As we do not need anything from the client, we ignore incoming messages. Leaves the loop on errors.

(pongWait time.Duration)

Source from the content-addressed store, hash-verified

59// startWriteHandler starts listening on the client connection. As we do not need anything from the client,
60// we ignore incoming messages. Leaves the loop on errors.
61func (c *client) startReading(pongWait time.Duration) {
62 defer c.NotifyClose()
63 c.conn.SetReadLimit(64)
64 c.conn.SetReadDeadline(time.Now().Add(pongWait))
65 c.conn.SetPongHandler(func(appData string) error {
66 c.conn.SetReadDeadline(time.Now().Add(pongWait))
67 return nil
68 })
69 for {
70 if _, _, err := c.conn.NextReader(); err != nil {
71 printWebSocketError("ReadError", err)
72 return
73 }
74 }
75}
76
77// startWriteHandler starts the write loop. The method has the following tasks:
78// * ping the client in the interval provided as parameter

Callers 1

HandleMethod · 0.80

Calls 2

NotifyCloseMethod · 0.95
printWebSocketErrorFunction · 0.85

Tested by

no test coverage detected