I have a browser application with the following code:
const client = mqtt.connect(options);
client.on('connect', e => {
client.publish(`events/${clientId}/service/up`, JSON.stringify({
action: 'up',
client: clientId,
timestamp: Math.floor(Date.now() / 1000)
}));
});
The connect handler seems to be called continuously:
{
"cmd": "connack",
"retain": false,
"qos": 0,
"dup": false,
"length": 2,
"topic": null,
"payload": null,
"sessionPresent": false,
"returnCode": 0
}
Output from subscribing to events/#:
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772528}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772530}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772533}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772536}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772539}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772542}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772545}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772548}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772551}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772554}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772557}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772560}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772563}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772566}
{"action":"up","client":"web-client-jv665k8a","timestamp":1556772568}
This only happens when the client is not busy sending/receiving messages.
What could explain this behavior?
@goliatone Were you able to solve this issue?
I am also facing this issue in browser.
Tested ./example/client/simple-publish.js
The connect handler seems to be called continuously:

@abhinav-juneja the behavior seems to be intermittent, I have not been able to understand the issue behind
I have the same problem