I’m dealing with this same problem, though we use the SendbirdUIKitContainer
and update the appId
that is passed into it, which would ideally update the SendbirdChat instance.
We have a multi-tenant setup with the potential for a single end user to belong to multiple organizations/Sendbird apps. To support this, we have the ability in our app for a user to change their Sendbird app at runtime, similar to changing orgs in Slack.
When the active organization ID changes in our redux store, that triggers a series of hooks to run, including changing the appId
that is passed into the SendbirdUIKitContainer
. I also call await disconnect()
and await connect()
in response to changing the org. Logs show that the connect()
call succeeds and sdk.connectionState
is OPEN
. Sendbird’s internal logs also show success here.
However, the UI fragments from @sendbird/uikit-react-native
which are mounted in the app have their own network requests running, and the logs start showing [debug] fail api request [SendbirdError: Connection is required.]
. I assume this is related to the SDK instance not being updated properly.
(Both of these apps work correctly if I use them to initialize Sendbird on app launch, only switching between them causes the connection error.)
Question:
Is changing the Sendbird app ID supported at runtime in the React Native and JS SDKs? I asked about this scenario before, but no limitation was mentioned.