fix(voice): broadcast VOICE_JOIN/LEAVE via ws, show participants in sidebar for all users

This commit is contained in:
2026-07-09 12:47:42 -04:00
parent 62e8354d03
commit e6dfe43926
9 changed files with 92 additions and 12 deletions
+12
View File
@@ -155,6 +155,18 @@ func (c *Client) readPump() {
c.Hub.BroadcastEvent(Event{Type: event.Type, Data: data})
case EventPresenceUpdate:
c.Hub.BroadcastEvent(event)
case EventVoiceJoin, EventVoiceLeave, EventVoiceMute, EventVoiceDeafen:
// Broadcast voice state changes to all clients with sender info
var vData map[string]interface{}
if raw, ok := event.Data.(json.RawMessage); ok {
json.Unmarshal(raw, &vData)
}
if vData == nil {
vData = make(map[string]interface{})
}
vData["user_id"] = c.UserID
vData["username"] = c.Username
c.Hub.BroadcastEvent(Event{Type: event.Type, Data: vData})
case EventVoiceWhisper:
// Forward voice whispers only to the target user, not broadcast
var whisperData struct {