Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

429
Views
Mqtt connection Failed- [ React native ]

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.
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!