fix(voice): broadcast VOICE_JOIN/LEAVE via ws, show participants in sidebar for all users
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user