sitegui / nodejs-websocket

A node.js module for websocket server and client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keep Alive?

dannysmc95 opened this issue · comments

Hi there,

I am currently using this for a work project, I am struggling to see why I keep getting this issue:
'This socket has been ended by the other party', I assume it needs some kind of keep alive? or is this already included with this?

Thanks,
Danny

commented

How long are you connected before it drops the socket? A lot of routers (most) will drop idle sockets after a couple of minutes. You can either send a keep alive or if you want to keep it slimmer you can check for the close event and just reconnect if it's not closing for a good reason. :)

Thanks @BadOPCode that's not a bad shout! When you say keep alive, I thought this library had a keep alive? Apparently you can set it in the websocket server connection scope.

Hi @dannysmc95 , you're right, this lib does not change the default Node's keepAlive.

However you can use socket API to change that: myWebSocketConnection.socket.setKeepAlive(true)