diff --git a/changes.d/586.feat.md b/changes.d/586.feat.md new file mode 100644 index 00000000..8d4acb9a --- /dev/null +++ b/changes.d/586.feat.md @@ -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. diff --git a/cylc/uiserver/jupyter_config.py b/cylc/uiserver/jupyter_config.py index 3caf105e..8423e18a 100644 --- a/cylc/uiserver/jupyter_config.py +++ b/cylc/uiserver/jupyter_config.py @@ -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"}' diff --git a/setup.cfg b/setup.cfg index 8e2e9260..143f21ff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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