Skip to content
Zack Piper edited this page Aug 18, 2014 · 5 revisions

API Reference

Client(info)

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
});

Client.add(info)

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'
  }])

Clone this wiki locally