fix: unreliable websocket functionality (#144)
* increases timeout * refactor: reuse constants for redis db * avoid closing connection on pong error * fix: prevent electron from pausing timer executions Our pings could be paused when our app is backgrounded. * refactor: remove unnecessary refs * fix: presence unreliable within same pod It was broadcasting presence changes to other pods, but not notifying clients connected to the same pod
This commit was merged in pull request #144.
This commit is contained in:
@@ -41,15 +41,14 @@ func (c *Conn) ReadPump(ctx context.Context, hub *Hub) {
|
||||
slog.Info("websocket context cancelled", "connId", c.id, "humanId", c.humanID, "error", ctx.Err())
|
||||
return
|
||||
}
|
||||
slog.Info("websocket read error", "connId", c.id, "humanId", c.humanID, "error", err)
|
||||
slog.Warn("websocket read error", "connId", c.id, "humanId", c.humanID, "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Respond to keep-alive pings
|
||||
if string(data) == "ping" {
|
||||
if err := c.ws.Write(ctx, websocket.MessageText, []byte("pong")); err != nil {
|
||||
slog.Debug("websocket pong write error", "connId", c.id, "error", err)
|
||||
return
|
||||
slog.Warn("websocket pong write error", "connId", c.id, "error", err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user