Skip to content
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

Suggestion: Add ability to send ping_payload with different opcode #882

Closed
bjebert opened this issue Dec 20, 2022 · 1 comment
Closed

Suggestion: Add ability to send ping_payload with different opcode #882

bjebert opened this issue Dec 20, 2022 · 1 comment

Comments

@bjebert
Copy link

bjebert commented Dec 20, 2022

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.

@engn33r
Copy link
Collaborator

engn33r commented Jan 26, 2023

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.

@engn33r engn33r closed this as completed Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants