You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found the run_forever function to be extremely useful in handling sending periodic ping messages. However, I'm faced with a websocket server which only responds to a specific ping payload sent with opcode=2. It then returns its "pong" over opcode=2. In my use case, I don't particularly care about receiving the pong, so have set ping_timeout=None. However, I would appreciate the option to send ping_payload with opcode=2 rather than the default opcode=9.
My alternative is writing async code to handle sending the ping with something like ws.send(ping_payload, opcode=2), but the run_forever function suits me perfectly otherwise.
I appreciate this is a somewhat niche use case, so I understand if this functionality is deemed unnecessary or if it goes against best practices to implement.
The text was updated successfully, but these errors were encountered:
The behavior you are describing breaks the WebSocket specification. RFC6455 specifies opcode 9 is for ping frames. Because this library intends to follow the specification, as described in the README, you will need to make a custom modification to your local version of the code.
I've found the
run_forever
function to be extremely useful in handling sending periodic ping messages. However, I'm faced with a websocket server which only responds to a specific ping payload sent with opcode=2. It then returns its "pong" over opcode=2. In my use case, I don't particularly care about receiving the pong, so have set ping_timeout=None. However, I would appreciate the option to send ping_payload with opcode=2 rather than the default opcode=9.My alternative is writing async code to handle sending the ping with something like
ws.send(ping_payload, opcode=2)
, but therun_forever
function suits me perfectly otherwise.I appreciate this is a somewhat niche use case, so I understand if this functionality is deemed unnecessary or if it goes against best practices to implement.
The text was updated successfully, but these errors were encountered: