I have a React Native app which uses the Twilio Chat API to connect to a channel. I am using this repo: https://github.com/twilio/TwilioChatJsReactNative
I am using this.generalChannel.join()
to join my general channel. This works for any new user.
I have the token generator running in the background as per the documentation in the readme of the repo.
However, when I try to login with an existing user's name, I get an error with the statusText
of 'Member already exists'.
How can I log in to my Twilio Chat channel with an existing user?
In the channel
object there is a state
object. In there is status
, which will equal joined
if the user is already a member of the channel. Just do something like if(channel.state.status !== "joined") channel.join()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With