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(useWebSocket): enhence heartbeat #2170
Conversation
useWebsocket stopeed working in version v9.2.0, so something is broken now |
@volarname can you describe the situation or offer some repo?
|
From this code a "pong" seems to be mandatory... and probably why it broke. My server also don't send pongs and have some quiet times |
@kellerza My concept is
2.every time you get a server response, |
Here we are talking about an app layer heartbeat, so there is no right/wrong on how to implement it. Up to 9.2.0 you can freely enable the heartbeat without any support from the server. Not necessarily wrong, but the behavior changed enough to bring down my and @volarname's websockets after the upgrade |
fyi, not arguing about the behavior. I already added the pong to my server and will go to 9.2.0 eventually... |
This also affects |
One thing I ran into is that it doesn't appear that your ping message is being sent with the correct opcode. It is coming across as a TextMessage (0x1) for me so my server wasn't recognizing the ping. According to the websocket spec, you should use an opcode of 0x9. And you might want to also check the pong message for an opcode of 0xA. |
@ssickles this it seems that the browser/JS API only exposes TextMessages. So this is an application layer heartbeat, rather than the Websocket ping/pong that uses other opcodes from the RFC |
I'm having a problem with firefox "Firefox can’t establish a connection to the server at ws://127.0.0.1:8080/ws.". Connection status is open but running send function gives the previous error. If set to autoReconnect status wont reach the open state at all and will continue trying to establish the connection. With chrome based browsers there is no issue. |
Description
issue: #2096
pongTimeout
-> after sending ping, could not recieve any response in pongTimeout, then close the socketAdditional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).