fix(websocket): errors in saving client info during ping ping

This commit is contained in:
2025-07-29 20:13:05 -05:00
parent daf9e8a966
commit 4368111311
5 changed files with 136 additions and 28 deletions

View File

@@ -83,6 +83,7 @@ func CleanupChannels() {
}
func StartBroadcasting(broadcaster chan logging.Message, channels map[string]*Channel) {
logger := logging.New()
go func() {
for msg := range broadcaster {
switch msg.Channel {
@@ -90,7 +91,9 @@ func StartBroadcasting(broadcaster chan logging.Message, channels map[string]*Ch
// Just forward the message - filtering happens in RunChannel()
messageBytes, err := json.Marshal(msg)
if err != nil {
log.Printf("Error marshaling message: %v", err)
logger.Error("Error marshaling message", "websocket", map[string]interface{}{
"errors": err,
})
continue
}
channels["logServices"].Broadcast <- messageBytes
@@ -99,7 +102,9 @@ func StartBroadcasting(broadcaster chan logging.Message, channels map[string]*Ch
// Future labels handling
messageBytes, err := json.Marshal(msg)
if err != nil {
log.Printf("Error marshaling message: %v", err)
logger.Error("Error marshaling message", "websocket", map[string]interface{}{
"errors": err,
})
continue
}
channels["labels"].Broadcast <- messageBytes