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:
David Zhao
2023-08-19 23:03:09 -07:00
committed by GitHub
parent 1078d96ff5
commit 75f5387ccd
4 changed files with 20 additions and 19 deletions
+1
View File
@@ -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:
+7
View File
@@ -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
}