I'm trying to connect and get the data from topic sent by sensor. Unfortunately the connection not working. in the console doesn't show no msg
Ps: I'm using react_native_mqtt lib and a port : 80
Any help is appreciated.
constructor(){
super();
this.onMessageArrived = this.onMessageArrived.bind(this)
this.onConnectionLost = this.onConnectionLost.bind(this)
this.onConnect = this.onConnect.bind(this)
const client = new Paho.MQTT.Client(host, Number(port), clientID);
client.onMessageArrived = this.onMessageArrived;
client.onConnectionLost = this.onConnectionLost;
client.connect({
onSuccess: this.onConnect,
useSSL: false,
userName: "user",
password: "pass",
onFailure: this.onConnectionLost
});
this.state = {
message: [''],
client,
messageToSend:'',
isConnected: false,
};
}
onConnect = () => {
const { client } = this.state.client;
console.log("Connected!!!!");
client.subscribe(topic, () => {
console.log('subscribe success topic1');
});
this.setState({isConnected: true, error: ''})
};
After a few minute:
Android Running app on Android SDK built for x86
onConnectionLost:AMQJS0007E Socket error:undefined.