livekit / client-sdk-swift

LiveKit Swift Client SDK. Easily build live audio or video experiences into your mobile app, game or website.
https://livekit.io
Apache License 2.0
173 stars 84 forks source link

Participant unable to join room with a token which contains "canSubscribe": false in IOS SDK 2.0.7 #380

Closed royatanu94 closed 4 weeks ago

royatanu94 commented 1 month ago

Describe the bug Hi All, Found an issue with ios sdk, where if you try to join with a token which contains "canSubscribe": false, it gives error Invalid state(Publisher is nil) but same works in other sdk. SDK Version

Please provide the SDK version. 2.0.7 iOS/macOS Version IOS The OS version which the issue occurs. ios17 Steps to Reproduce Try to join room with "canSubscribe": false permission, it will fail.

Token created using: { "identity": "atanu-ios1", "room": "demo-room-ios-test", "roomJoin": true, "canPublish": true, "canPublishData": false, "canSubscribe": false, "roomCreate" : false, "roomAdmin" : false, "roomList": true, "roomRecord": false,
"metadata": "data1", "canPublishSources": [ "MICROPHONE", "CAMERA", "SCREEN_SHARE" ] }

Expected behavior User should able to join room where user will only publish data won't subscribe other tracks using "canSubscribe": false attribute in token.

Screenshots

image

Logs Room.cleanUp(withError:isFullReconnect:) withError: Optional(Error Domain=.xxx Code=104 "Invalid state(Publisher is nil)" UserInfo={NSLocalizedDescription=Invalid state(Publisher is nil)})

hiroshihorie commented 4 weeks ago

Thanks for reporting. This has been fixed and confirmed with updated tests . This will be in the next version. I will close this for now.