jupyter/terminado

websocket server not closing connection when terminal is idle

dilip26 opened this issue · 3 comments

websocket server not closing connection when terminal is idle

I'm not quite sure what you mean. It's not meant to close the connection when the terminal is idle. You don't know when some output might arrive and need to be sent to the frontend.

What I meant is, I wanted to close the connection when there is no response from the end user for 10 minutes.

for eg, like SSH timeout "broken pipe" after few minutes if the user is inactive on the terminal it closes the connection with msg broken pipe
Thank you in advance.

I thought that was just an error, not a feature ;-).

We use terminals in Jupyter, and we have this code in a subclass to track when a terminal was last active:

https://github.com/jupyter/notebook/blob/97b3b96f3dbec25390502a1bf1d4f113b6d16b59/notebook/terminal/handlers.py#L36-L42

You could use that to automatically close the terminal when its last activity was more than a certain time ago.