Changeset 0.33.0 (#207)

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit is contained in:
2026-03-19 21:37:32 +00:00
committed by xcaliber
parent b1266b0d7c
commit ed3e9363f2
42 changed files with 2527 additions and 129 deletions

View File

@@ -10,6 +10,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"chat-switchboard/metrics"
)
const (
@@ -121,6 +123,7 @@ func (h *Hub) HandleWebSocket(c *gin.Context) {
h.mu.Unlock()
log.Printf("[ws] connected: %s (user=%s, total=%d)", connID, userID, h.ConnCount())
metrics.WebSocketConnections.Inc()
// Subscribe this connection to bus events destined for clients
conn.subscribeToBus()
@@ -214,6 +217,7 @@ func (h *Hub) removeConn(conn *Conn) {
}
log.Printf("[ws] disconnected: %s (total=%d)", conn.id, h.ConnCount())
metrics.WebSocketConnections.Dec()
// Publish presence offline (only if no other conns for this user)
if len(h.ConnsByUser(conn.userID)) == 0 {