Skip to content
Aravind edited this page Jun 10, 2013 · 7 revisions

The core codebase is in /core/, the entry point is core.js and it's exposed as Node.js module with the following API:

core.init(gateways)

This is called by the launcher, and it provides a list of gateways as a hashmap. Each gateway should conform to the gateway API.

core.send(message)

This is called by gateways. The message object contains the from and to information necessary for routing. core.send identifies the rooms and accounts that should receive the message, adds the message to these rooms' archives and invokes the gateways' send() methods for these accounts.

core.send() might have other side effects depending on the message type, e.g. sending a 'follow' message creates a 'follow' relationship between the 'from' and 'to' nodes.

To see all the different message types and a description of their side effects, see Messages.

core.read(query)

This is called by gateways to retrieve messages from the archive. query must be an object can have one or more the following fields:

  • from, to, type: A single string or an array of strings.
  • since, until: A number (unix timestamp with millisecond precision).
  • label: Not yet implemented.

It returns at most 256 results, oldest first. If 'until' is specified, and since is not, the last retrieved message is guaranteed to be the latest available message with a timestamp less than the limit.

room(name|object)

Not implemented: Loads or creates a new room object for performing CRUD operations (admin and user registration) can be performed.

Clone this wiki locally