Monitoring Heartbeat with uWebSockets.js and socket.io Integration and Updating Device Status #1129
-
I am using this approach to integrate socket.io with uWebSockets.js. How can I monitor the heartbeat? The header of my connection includes a deviceid, and I want to update the deviceid with a Unix timestamp in Redis every heartbeat. The reason for implementing it this way is to determine whether these devices are currently online or, after killing socket.io, if these machines haven't reconnected, I could deduce they are offline by checking the expiration time along with the Unix timestamp. However, I am not able to catch the heartbeat. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
By default uWS guarantees that open/close callbacks are reliable. So you just trust them. No need to track heartbeats. |
Beta Was this translation helpful? Give feedback.
-
I am using socket.io, which encapsulates websocket.js. However, I want to capture the last heartbeat and store it. |
Beta Was this translation helpful? Give feedback.
-
is it normal that device goes offline on 12:20:58 and ONLINE on 12:21:48. it's contiously going online and offline ...
|
Beta Was this translation helpful? Give feedback.
By default uWS guarantees that open/close callbacks are reliable. So you just trust them. No need to track heartbeats.