robhogan / react-native-paho-mqtt

react-native-paho-mqtt
91 stars 32 forks source link

Always failed to connect to MQTT after changing to new URL #17

Closed KingjZhang closed 6 years ago

KingjZhang commented 6 years ago

@rh389 Thanks for great work. I can connect to AWS IoT MQTT by this library. But it always failed to connect to MQTT after changing the URL. If the user sign out and sign in to another account the URL will be changed. I call the disconnect and connect to new URL again it will give me an Error: AMQJS0011E Invalid state already connected.

tje3d commented 6 years ago

@KingjZhang how did you resolve this?

KingjZhang commented 6 years ago

@tje3d This issue occurs by the AWS Cognito Javascript library. It can't sign out by call the sign out API. It should call the API AWS.config.credentials.clearCachedId to clear the cached user sessions.

tje3d commented 6 years ago

@KingjZhang thanks but i have same problem with this library, which disconnect not works at all. The only solution i've found is to delete, or assign null to the connection instance.