-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server): add ws heartbeat #2404
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2404 +/- ##
======================================
Coverage 93.8% 93.8%
======================================
Files 34 34
Lines 1307 1307
Branches 371 371
======================================
Hits 1226 1226
Misses 79 79
Partials 2 2 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, what about client? Second part of https://github.com/websockets/ws#how-to-detect-and-close-broken-connections
@evilebottnawi Good point. However, we are using a native browser WebSocket (https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API), not a |
Hm, we need investigate that, i will look at that in near future |
I looked and tested the solution, it works well, I’m not sure about the client code, but the current code can be merged, a little later I will investigate the client in more detail |
@Loonride This is great, but I think you will still eventually get a timeout if you are stepping through your code in the browser dev tools. The browser is holding up the whole application so the client code cannot communicate with the server. You can easily test this by setting a breakpoint and wait until it times out. If that is true, then maybe the client code needs to be hardened as well. It should be able to reconnect to the server if it detects that the connection is broken. |
@gamedev8 I tested this and it seems that the WebSocket client can still be pinged by the server even while stepping through your code in dev tools. Could you test this yourself and confirm? |
@Loonride I tested it a few days ago and produced the issue, but it is possible that I did not set up properly. I will try again. |
For Bugs and Features; did you add new tests?
Yes, and also restructured the test file for WebsocketServer slightly
Motivation / Use-Case
Add ws heartbeat
#2403 (need investigate client code)
Breaking Changes
None
Additional Info