-
Notifications
You must be signed in to change notification settings - Fork 384
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
Handle ping/pong frames. #5
Comments
You are right. A major problem is that I don't actually check for the OPCODE of any message received except for a CLOSE_CONN opcode. There should be a warning or something when a non-supported OPCODE arrives (in this case PONG). As about implementation I think what makes sense (at least to me) is to check if the opcode is PING in Feel free to implement it if you want. I am jobless atm so I have no time to do any changes unfortunately.. If the implementation works fine and is consistent with the rest of the code, I can merge it. |
Whenever we receive a PING frame, we have to reply with a PONG frame with a payload identical to the one present in the received PING. we reuse the function send_text() to send the pong frame but add the opcode to be sent as an argument. This opcode defaults to OPCODE_TEXT so we do not break the compatibility. fixes Pithikos#5 Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Whenever we receive a PING frame, we have to reply with a PONG frame with a payload identical to the one present in the received PING. we reuse the function send_text() to send the pong frame but add the opcode to be sent as an argument. This opcode defaults to OPCODE_TEXT so we do not break the compatibility. fixes Pithikos#5 Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Whenever we receive a PING frame, we have to reply with a PONG frame with a payload identical to the one present in the received PING. we reuse the function send_text() to send the pong frame but add the opcode to be sent as an argument. This opcode defaults to OPCODE_TEXT so we do not break the compatibility. fixes Pithikos#5 Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
I am having some issues with certain browsers (mainly on embedded devices) that send ping (opcode 0x09) and/or pong (opcode 0x0A) frames without being solicited.
With the current implementation, those frames are handled like any text message (opcode 0x01) and there is no way to differenciate them from actual messages. The only workaround I found is to check if the payload of the frame matches a specific text (e.g. "PING"). IMHO the solution is rather unclean.
I am thinking of two ways to deal with the issue:
I can probably help with the code if needed.
Thank you by advance for reading :)
The text was updated successfully, but these errors were encountered: