Hello,
Sorry if this is a stupid question, but how would i go about sending SIGINT signal to a terminal instance programmatically?
Thanks
I guess you want to send SIGINT to the slave foreground program. For unaltered default termios settings sending Ctrl-C does the trick which is term.send('\x03') (see termios settings and control codes).
Thanks, that worked nicely. I was also having another unrelated issue, maybe you have an idea? When using demo app from this repo, after some time of terminal being open - terminal seems to automatically detach and close the session. Any idea what's the cause of this? How could i avoid it?
Do you access the demo locally or from a browser on a different machine? No clue what could cause this, I've never seen that with the demo app (tested only locally). Even after hours of sitting unused it is still working. Do the logs (server and browser) give any hints? My only guess is a faulty network link (Any drops? Switching IPs?) between browser and server part, if you do it remotely.
Yea, i'm accessing it from remote machine, with nginx proxy. From what i can see in the logs - it's a clean exit on the serverside, websocket closing on the clientside.
How far do you get with your setup, is the websocket upgraded correctly? (You should get at least some prompt output and be able to type something.) Maybe try changing the proxy_read_timeout?
I got the terminal working all the way - eveything is fully functional, just having this issue. After ~10 min of being open terminals detach. In this case i had 2 xterm terminal instances open and after some time both websockets emit close event:

i'll try and play around with config settings.
I'm having the same problem and exactly with NGINX Proxy.
I've seen that you closed the issue, but how did you solve the problem, @TaiAivaras?
Hey, it's been a while - but if i remember correctly i set up something like a heartbeat process - to push empty messages to the websocket, thus keeping it alive. Not sure it's the perfect solution tho.
I see that my connections are closed after ~1 minute of inactivity.
I'll do the same as you: send empty messages every ~30 seconds just to keep it alive.
Thanks @TaiAivaras !
Even if the heart beat worked, I tried to find a solution that attacks directly the source of the problem (nginx).
I finally found it. In case if the link get broken, the solution was to use proxy_read_timeout, like in the example below that sets the timeout for 7 days:
server {
location /chat/ {
proxy_read_timeout 604800;
}
}
I left a websocket open for ~70 minutes without data being transferred and the connection was still alive after that time.
@TaiAivaras @rubenanapu "empty messages" means "" or some other special characters? I tried sending "" but still get disconnection. i also tried \x00 which means null, but get ? as response data
Most helpful comment
I guess you want to send SIGINT to the slave foreground program. For unaltered default termios settings sending Ctrl-C does the trick which is
term.send('\x03')(see termios settings and control codes).