MQTT error after 5 minutes

I have a React-native application that I need to connect using IoT (AWS) using websockets. I am currently using the react-native-paho-mqtt package to connect my application. Here is my code:

function getClient(onConnect, onConnectionFailed, onConnectionLost, 
  onMessageArrived) {
  logger.trace('getClient()');
  const clientID = uuidV4();
  // Create a client instance
  const client = new Paho.MQTT.Client(signedUrl, clientID);  // eslint-disable-line no-undef

  // set callback handlers
  client.onConnectionLost = onConnectionLost;
  client.onMessageArrived = onMessageArrived;

  // connect the client
  client.connect({
    keepAliveInterval: 15,
    onSuccess: onConnect,
    onFailure: onConnectionFailed,
  });

  return client;
}

5 minutes after my main connection, I get an error message when I try to connect another client. I get this error: AMQJS0007E Socket error:{0}.. I no longer have error information.

Does anyone know what is happening or how to solve this problem?

+4
source share

Source: https://habr.com/ru/post/1675195/


All Articles