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

Disabling auto pong in the client #448

Open
gionapaolini opened this issue Nov 4, 2024 · 2 comments
Open

Disabling auto pong in the client #448

gionapaolini opened this issue Nov 4, 2024 · 2 comments

Comments

@gionapaolini
Copy link

I am using the tungstenite client in some integration tests and I wish to test the case in which the client stop responding to pings.
Quoting the documentation:

..For example, upon receiving ping messages tungstenite queues pong replies automatically. The next call to read, write or flush will write & flush the pong reply. This means you should not respond to ping frames manually... ...Note that if read returns a ping, you should flush before passing a custom pong to write, otherwise the automatic queued response to the ping will not be sent as it will be replaced by your custom pong message.

It seems I might be able to overwrite the pong if I do not flush, but is there a way to disable this auto-pong behavior altogether? If not, would it be welcomed as a new feature?

@daniel-abramov
Copy link
Member

Currently, there is no way to disable this behavior.

As for the feature - I personally don't have any arguments against it as for now - we could have an additional flag in the config to change this behavior so long our defaults are sane and don't make the usage of the library more complicated; also, it should be relatively easy to implement (if we're talking only about auto-pongs; a bit more complex if we want to disable all auto-replies, such as replying to the close frames, etc);

@agalakhov
Copy link
Member

Disabling auto replies effectively means disabling most of the impl WebSocket code. Looks like just using protocol::frame::Frame directly does the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants