Skip to content

Commit

Permalink
config: configure default websocket ping interval
Browse files Browse the repository at this point in the history
* Closes cylc#557
* Sends regular pings to websocket clients to ensure that the connection
  is still active and open at the other end.
* This allows for earlier detection of client-side connection closing.
  • Loading branch information
oliver-sanders committed Apr 23, 2024
1 parent b007b5f commit 6087a20
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions changes.d/586.feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The UI Server is now configured to regularly ping active clients to ensure they
are alive. This helps the server to detect closed connections sooner, it also
ensures that open connections do not appear idle to proxy servers which are
sometimes configured to kill websockets after a period of inactivity.
You can override or modify this behaviour in your jupyter configuration using
the `websocket_ping_interval` and `websocket_ping_timeout` configurations, see
the Jupyter Server reference for more information.
4 changes: 4 additions & 0 deletions cylc/uiserver/jupyter_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
)
]

# configure websocket pings (helps to detect client-closed connections)
c.ServerApp.websocket_ping_interval = 10
c.ServerApp.websocket_ping_timeout = 10

# store JupyterHub runtime files in the user config directory
USER_CONF_ROOT.mkdir(parents=True, exist_ok=True)
c.JupyterHub.cookie_secret_file = f'{USER_CONF_ROOT / "cookie_secret"}'
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ install_requires =
graphene
graphene-tornado==2.6.*
graphql-ws==0.4.4
jupyter_server>=2.7
jupyter_server>=2.13.0
requests
psutil
tornado>=6.1.0 # matches jupyter_server value
Expand Down

0 comments on commit 6087a20

Please sign in to comment.