Sage cell server dead after one request from client
I want to access the SAGE cell server programatically from Python 3. I found this example here, which uses the Websockets interface.
It works nice and smooth, but only for exactly one request, because after that the
execution_state of the connection is
dead. The documentation even describes that:
You’ll get a kernel dead message on the IOPub channel when the cell times out. If you don’t have interacts, it will time out pretty much immediately. If you do have interacts, then the timeout is something 30 or 60 seconds between each execute_request.
If I connect each time anew it will be slower for me and waste much more resources on the server side (I guess), so it would be best if I could somehow re-use the connection. Timeout only needs to be some 1-5 seconds, basically a couple of RTTs of the Internet.
Is there anything I could do?