makes net.connect() and net.createConnection() auto reconnect
npm install net-socket-reconnectjs
var reconnect= require('net-socket-reconnect')
var client= reconnect({port: 8080, reconnectInterval: 150}) // no change to original API
`
Options
* __reconnectOnError__ reconnect on 'error', default false
* __reconnectOnEnd__ reconnect on 'end', default false
* __reconnectOnClose__ reconnect on 'close', default true
* __reconnectOnTimeout__ reconnect on 'timeout', default false
* __reconnectOnCreate__ reconnect after initial connect failed, default false
* __reconnectInterval__ interval between tries, default 300
* __reconnectTimes__ max retries, default 50> __note__: 50 * 300= 15,000. That's 15 seconds of retrying and then giving up with
reconnectFailed eventMethods
Except the original events, there's a few new ones:
* __client.reconnect()__ ends current connection and reconnects; or simple reconnects if you set all auto reconnect options to false (and decided to deal with it manually)
* __client.stopReconnect()__ stops any further reconnect actions
* __client.startReconnect()__ restarts reconnect
* __client.getReconnect()__ get current reconnect state: true/on, or false/offEvents
Except the original events, there's a two new ones:
* __reconnect__ when successfuly reconnected
* __reconnectFailed__ when reconnect reached reconnectTimes > __important__: every successful reconnect will also emit __
'connect'__ event by net.Socket, so plan your client.on('connect', function(){}) callbacksInstallation
`
npm install net-socket-reconnect
``