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

Method Handle

api/stream/stream.go:143–154  ·  view source on GitHub ↗

Handle handles incoming requests. First it upgrades the protocol to the WebSocket protocol and then starts listening for read and writes. swagger:operation GET /stream message streamMessages Websocket, return newly created messages. --- schema: ws, wss produces: [application/json] security: [c

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

141// schema:
142// $ref: "#/definitions/Error"
143func (a *API) Handle(ctx *gin.Context) {
144 conn, err := a.upgrader.Upgrade(ctx.Writer, ctx.Request, nil)
145 if err != nil {
146 ctx.Error(err)
147 return
148 }
149
150 client := newClient(conn, auth.GetUserID(ctx), auth.GetTokenID(ctx), a.remove)
151 a.register(client)
152 go client.startReading(a.pongTimeout)
153 go client.startWriteHandler(a.pingPeriod)
154}
155
156// Close closes all client connections and stops answering new connections.
157func (a *API) Close() {

Callers

nothing calls this directly

Calls 7

registerMethod · 0.95
GetUserIDFunction · 0.92
GetTokenIDFunction · 0.92
newClientFunction · 0.85
ErrorMethod · 0.80
startReadingMethod · 0.80
startWriteHandlerMethod · 0.80

Tested by

no test coverage detected