livekit / client-sdk-swift

LiveKit Swift Client SDK. Easily build live audio or video experiences on iOS, macOS, tvOS, and visionOS.
https://livekit.io
Apache License 2.0
195 stars 97 forks source link

Issue with Swift Client SDK: RoomData Messages Not Reaching Participants #262

Open rjaintest23 opened 11 months ago

rjaintest23 commented 11 months ago

Dear Livekit Team, I'm working on a meeting application utilizing the Livekit Swift client SDK. We're encountering an issue where RoomData messages are not reaching participants after we dynamically update their permissions. Problem: After granting participants permissions for subscription and publishing, RoomData messages sent through the server SDK are not received by Swift client users, whereas Android and web SDK users receive them correctly. Steps to Recreate the Issue:

1. Create a token with initial permissions set to false: livekit-cli create-token --api-key API4cb8pbrAQPL8 --api-secret pMNZzkNWfUUzIeDmEUtul9vFQOT8T3amf52c5JfprYND --join --room room --identity user --grant '{"canSubscribe":false,"canPublish":false,"canPublishData":false}'

2. Join the room using the Livekit iOS demo app.

3. Update the participant's permissions to set 'canPublish' and 'canSubscribe' to true: livekit-cli update-participant --url wss://demo-s8zwk6eo.livekit.cloud/ --api-key API4cb8pbrAQPL8 --api-secret pMNZzkNWfUUzIeDmEUtul9vFQOT8T3amf52c5JfprYND --room room --identity user --permissions '{"can_subscribe":true,"can_publish":true}'

4. Try sending data to the room. Expected behavior is that this participant should receive the data, but the observed behavior is that this participant does not receive the data. This issue of not receiving RoomData messages only occurs when the initial permissions of the participants are set to false. livekit-cli send-data --url wss://demo-s8zwk6eo.livekit.cloud/ --api-key API4cb8pbrAQPL8 --api-secret pMNZzkNWfUUzIeDmEUtul9vFQOT8T3amf52c5JfprYND --room room --data "data"

Note: The same message is received by the iOS Swift user when the initial create token method is called with canSubscribe and canPublish permissions set to true. Below are attached images:

  1. Web receiving data message after permissions are updated to canSubscribe and canPublish true
  2. Web receiving data messages when intial permissions of canSubscribe, canPublish and canPublishData are set to false
  3. IOS not receiving the data message even after permissions are updated to canSubscribe and canPublish true
  4. IOS receiving the data message when the intial create token canPublish and canSubscribe permissions are set to true

Note: We are okay with that failed to decode data error, as in our application we are handling received data messages differently compared to livekit demo app. Your prompt attention to this matter is highly appreciated. If more information or specific code examples are required to diagnose and address this issue, please let us know. Livekit data received on web after updating permissions Livekit data received on web after updating permissions (1) MicrosoftTeams-image (1) (1) MicrosoftTeams-image (2)

rjaintest23 commented 11 months ago

Please find the package dependencies versions, that I am using in my project.

Screenshot 2023-10-20 at 5 14 44 PM