You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functiononMessage(message){letdata=JSON.parse(message.payloadString)console.log(data)}functiononConnectionLost(responseObject){if(responseObject.errorCode!==0){console.log('onConnectionLost:'+responseObject.errorMessage)}}useEffect(()=>{if(something){try{client.connect({onSuccess: ()=>{console.log('Connected!')client.subscribe(`device/default`)client.onConnectionLost=onConnectionLostclient.onMessageArrived=onMessage},onFailure: ()=>{console.log('Failed to connect!')},})}catch(error){console.log(error)}}},[something])
It works but when I change the screen(react-navigation) I will got this error:
AMQJS0011E Invalid state already connected.
and nothing gets.
( Only when I reload the expo can get data again.)
Is there anything I miss?
Thank you!
The text was updated successfully, but these errors were encountered:
Hi,
env: "react-native": "0.69.6",
version: "paho-mqtt": "^1.1.0",
I wrote the code like this :
It works but when I change the screen(react-navigation) I will got this error:
AMQJS0011E Invalid state already connected.
and nothing gets.
( Only when I reload the expo can get data again.)
Is there anything I miss?
Thank you!
The text was updated successfully, but these errors were encountered: