-
Notifications
You must be signed in to change notification settings - Fork 6
API
Zack Piper edited this page Aug 18, 2014
·
5 revisions
Initialise a server connection using the info parameter. info can be a javascript object representing server details or an array of multiple server details.
Example:
var client = Client({
'name': 'freenode', // Optional
'host': 'chat.freenode.net', // Required
'port': 6697, // Optional
'ssl': true, // Optional
'nick': 'nickname', // Required
'username': 'test', // Optional
'realname': 'Testing Robot' // Optional
});Add another network to an existing client, since the API supports multiple servers, more than one add calls can be specified throughout your program.
Multi-server example:
client.add([{ // previously defined
host: 'chat.freenode.net', // required
name: 'freenode', // optional, but aids in identification, when referenced later in the program.
nick: 'test', // required
ssl: true, // optional
username: 'test', // optional
'realname': 'Testing Robot' // optional'
},
{
host: 'chat.freenode.net', // required
name: 'freenode', // optional, but aids in identification, when referenced later in the program.
nick: 'test2', // required
ssl: false, // optional
username: 'test', // optional
'realname': 'Testing Robot' // optional'
}
]);Single-server example:
client.add([{ // previously defined
host: 'chat.freenode.net', // required
name: 'freenode', // optional, but aids in identification, when referenced later in the program.
nick: 'test', // required
ssl: true, // optional
username: 'test', // optional
'realname': 'Testing Robot' // optional'
}])