Allow data packet to be sent to participants by identity (#1982)
* Allow data packet to be sent to participants by identity * update gomodules
This commit is contained in:
@@ -1340,6 +1340,7 @@ func (p *ParticipantImpl) onDataMessage(kind livekit.DataPacket_Kind, data []byt
|
||||
p.lock.RUnlock()
|
||||
if onDataPacket != nil {
|
||||
payload.User.ParticipantSid = string(p.params.SID)
|
||||
payload.User.ParticipantIdentity = string(p.params.Identity)
|
||||
onDataPacket(p, &dp)
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -1283,6 +1283,7 @@ func (r *Room) DebugInfo() map[string]interface{} {
|
||||
func BroadcastDataPacketForRoom(r types.Room, source types.LocalParticipant, dp *livekit.DataPacket, logger logger.Logger) {
|
||||
dest := dp.GetUser().GetDestinationSids()
|
||||
var dpData []byte
|
||||
destIdentities := dp.GetUser().GetDestinationIdentities()
|
||||
|
||||
participants := r.GetLocalParticipants()
|
||||
capacity := len(dest)
|
||||
@@ -1306,6 +1307,12 @@ func BroadcastDataPacketForRoom(r types.Room, source types.LocalParticipant, dp
|
||||
break
|
||||
}
|
||||
}
|
||||
for _, dIdentity := range destIdentities {
|
||||
if op.Identity() == livekit.ParticipantIdentity(dIdentity) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user