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

websocket: Periodic pinging for failure detection #1957

Merged
merged 5 commits into from
Feb 25, 2017

Conversation

bdarnell
Copy link
Member

Optionally ping the other end of a websocket connection periodically, and close the connection if no response is received (to supplement kernel-level failure detection for the TCP connections, and to keep some proxies from dropping the connection).

Fixes #1640
Closes #1642
Closes #1938

@takluyver and @astawiarski, your changes are included here. @awong1900, you asked for a client-side ping() method in #1640. Do you really need manual control of pings (and responses) or is this ping_interval and ping_timeout enough for you?

takluyver and others added 5 commits February 15, 2016 14:41
Closes tornadowebgh-1640

As Ben requested on tornadoweb#1640, I've changed it to work in seconds rather
than milliseconds.

I'm not sure how we'd test something like this. I don't think we have
tests for it in Jupyter.
In order to implement proper application-level handling of disconnections
a developer may want to hook up into the standard "ping" mechanism
of the websocket protocol. This is important for systems where
both the client and the server need to keep track of disconnections,
but based on client-intiated pings only.
@awong1900
Copy link

I think it needs. If the server does not do ping and on_pong(with timeout check), I would like to manually implement the ping on client to ensure that the connection.

@bdarnell bdarnell changed the title websocket: Periodic pinging for failure connection websocket: Periodic pinging for failure detection Feb 25, 2017
@bdarnell
Copy link
Member Author

@awong1900 Why do you want to do it manually? (notice that you can pass ping_interval to websocket_connect on the client side too) What would you want the interface for that to look like?

@bdarnell bdarnell merged commit e15dbaa into tornadoweb:master Feb 25, 2017
@bdarnell bdarnell deleted the ws-ping branch February 25, 2017 22:35
@awong1900
Copy link

awong1900 commented Feb 26, 2017

I checked your commit code. If have 'ping_interval' on client, I think no need to control ping manually.

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

Successfully merging this pull request may close these issues.

Option to periodicaly ping idle websockets to keep proxies happy
3 participants