You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To solve #1361 ,I've tried MQTT version 5.3.3 recently, it's able to maintain the connection automatically when client browser tab are blured or the whole browser is minimized, which works well.
However, when the computer enters sleep mode, the heartbeat stops sending immediatly.And the weirdest thing is, I purposefully added a close callback in the MQTT method to reconnect after disconnection. However, after the computer goes into sleep and then wakes up, none of the console.log in the close callback are printed. It seems like the JavaScript code in the callback hasn't been executed at all. By the way, In my tests, I tried to manually disconnect the client from the server while in the awake state. This does trigger the code in the close callback, and it can reconnect normally.
If that happens means the pc also pauses the worker thread, I think that's an os issue or maybe a setting to save power not an issue with MQTTjs
I also assumed the same, but a few weeks ago, I was still using the v4.x version of MQTT.js. I specifically wrote a mqtt.worker.js in my local project to handle this issue, and it worked very well, able to maintain the connection all night. When I put my computer to sleep at night, then open it in the morning, I can see the print log in the browser console. The client continues to loop through the "disconnect-reconnect" sequence as expected.
However, in recent days I've noticed that it seems like after entering sleep mode, all of the JavaScript is unable to execute in the background. Instead, it seems to pile up and only executes at the moment the machine is woken up. I am trying to figure out why this is happening.
This is an automated message to let you know that this issue has
gone 365 days without any activity. In order to ensure that we work
on issues that still matter, this issue will be closed in 14 days.
If this issue is still important, you can simply comment with a
"bump" to keep it open.
To solve #1361 ,I've tried MQTT version 5.3.3 recently, it's able to maintain the connection automatically when client browser tab are blured or the whole browser is minimized, which works well.
However, when the computer enters sleep mode, the heartbeat stops sending immediatly.And the weirdest thing is, I purposefully added a close callback in the MQTT method to reconnect after disconnection. However, after the computer goes into sleep and then wakes up, none of the console.log in the close callback are printed. It seems like the JavaScript code in the callback hasn't been executed at all. By the way, In my tests, I tried to manually disconnect the client from the server while in the awake state. This does trigger the code in the close callback, and it can reconnect normally.
I'm not sure if this is a problem with this MQTT.js library, the browser, or the Windows operating system.
System Info
The text was updated successfully, but these errors were encountered: