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

360
Views
MQTT reacciona nativo obteniendo una conexión de tiempo de espera Paho-mqtt

Estoy tratando de conectarme al corredor mqtt de mi escuela usando reaccionar nativo. El problema es que no puedo conectarme y me dan dos errores....

El primero es: Objeto { "código de error": 1, "Mensaje de error": "AMQJSC0001E Se agotó el tiempo de espera de conexión.", "Contexto de invocación": indefinido, }

y el segundo: Error: AMQJS0011E Estado no válido ya conectado.

el segundo aparece cuando presiono el botón "DeployParachute.

Este es mi código:

 import * as React from "react"; import { useState } from "react"; import { StyleSheet, View, Text, TouchableOpacity } from "react-native"; import Paho from "paho-mqtt"; export default function App() { const client = new Paho.Client( '172.30.X.X', Number(1883), 'hicheme' ); function subscribeTopics () { client.subscribe("tags"); } function onFailure(msg) { console.log("Failed to connect",msg); } function onConnectionLost(responseObject) { console.log("Connection Lost" + responseObject); } function deployParachute() { client.connect({ onSuccess: function () { console.log("deploying parachute"); }, onFailure: function(msg){ console.log("failte to connect",msg ) }, useSSL: true, }); } const [connected, setConnected] = useState(false); const mqtt_options = { onSuccess: onConnect, onFailure: onFailure, }; function onConnect() { console.log("connected") setConnected(true); subscribeTopics (); } function onMessage(message) { //console.log('Topic: ' + message.destinationName + ", Message: " + message.payloadString); console.log('message',JSON.parse(message)); } if (!connected) { client.connect(mqtt_options); client.onConnectionLost = onConnectionLost; client.onMessageArrived = onMessage; console.log("Why i'm here????????????") } return ( <View style={styles.container}> <TouchableOpacity onPress={deployParachute} style={styles.button}> <Text>Deploy Parachute!</Text> </TouchableOpacity> </View> ) } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#fff", alignItems: "center", justifyContent: "center", }, button: { backgroundColor: 'red', padding: 20, borderRadius: 5, }, buttonText: { fontSize: 20, color: '#fff', }, })

alguien me puede ayudar por favor

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!