martynsmith / node-irc

NodeJS IRC client library
GNU General Public License v3.0
1.33k stars 424 forks source link

how do I auto reconnect if the server goes down? #431

Closed x13machine closed 8 years ago

x13machine commented 8 years ago

how do I auto reconnect if the server goes down? I'm using the latest version

ineeee commented 8 years ago

Its not documented anywhere, but you can pass retryCount and retryDelay when creating a new Client. It will automatically reconnect if the connection is dropped.

var irc = require('irc');

new irc.Client('irc.example.org', 'someone', {
    // milliseconds to wait between retries
    retryDelay: 1000,

    // max attempts
    retryCount: 2
}