Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH Keepalive should be set #14

Open
voipnorm opened this issue Aug 1, 2018 · 1 comment
Open

SSH Keepalive should be set #14

voipnorm opened this issue Aug 1, 2018 · 1 comment

Comments

@voipnorm
Copy link

voipnorm commented Aug 1, 2018

In the jsxapi library the ssh keep alive by default is turned off. This is the default of the ssh2 library used by jsxapi. While this is not a big problem if your endpoint goes down gracefully, it is if it suddenly loses network connectivity. Basically your ssh session will just hang as might your nodejs application. If the endpoint comes back on a different ip address for what ever reason your ssh session will never recover meaning having to restart your application to recover your connection. The solution how ever is actual very simple. Just add the keepaliveInterval attribute to the connect object and your good to go. This enables ssh keepalives (in milliseconds). Just ensure you use an integer not a string for the timer. This will then generate a event error at disconnect allowing you to recover your ssh session how ever you see fit.

const xapi = jsxapi.connect('ssh://host.example.com', {
username: 'admin',
password: 'password',
keepaliveInterval: 4000
});

@myme
Copy link
Contributor

myme commented Aug 1, 2018

I vote for having a sensible default keepaliveInterval, but still allow for users to override the value, or disable it by setting it to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants