Skip to content

feat: implement heartbeating#13

Merged
ySnoopyDogy merged 1 commit intomasterfrom
feat/heartbeat
Feb 15, 2024
Merged

feat: implement heartbeating#13
ySnoopyDogy merged 1 commit intomasterfrom
feat/heartbeat

Conversation

@ySnoopyDogy
Copy link
Member

@ySnoopyDogy ySnoopyDogy commented Feb 13, 2024

With this implementation of ping/pong responses, we avoid the Websocket connection being closed after 60 secs of inactivity.

To test the ping system working, open your broswer console and then run:

window.DEBUG = true;

The way its implemented now, the front send starts the sequence each 10 seconds. When the sequence starts, a PING message is sent. If its not responded in 500ms, another PING is sent. This repeats 5 times, increasing the delay between messages in 500ms. If the server respond to any PONG sent, the connection is considered healthy, and sets another 10 seconds delay to start the next heartbeat sequence

With this implementation of ping/pong responses, we avoid the Websocket connection being closed after 60 secs of inactivity
@ySnoopyDogy ySnoopyDogy merged commit a928802 into master Feb 15, 2024
@ySnoopyDogy ySnoopyDogy deleted the feat/heartbeat branch February 15, 2024 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants