Skip to content
harrysofter edited this page Jun 27, 2013 · 2 revisions

Gateways may implement the following methods:

init()

Called when scrollback starts up. This is where any persistent socket connections can be established with external servers.

add(account)

Called when the new account of this gateway is added.

Send a message to the external network. Accounts is an array. It doesn't really have to send immediately or at all.

Note: Make sure you check for echo! Messages that originated in this gateway will be sent back to the same gateway, if the sender is also subscribed to the destination room. Depending on the external network, you may or may not want to update it.

auth(accountId, token, callback)

Check if the token is a valid authentication token for the provided account ID, call back with true or false. For example, a gateway to an OAuth service may receive this call with the user ID and access token; the IRC gateway may be called with the NickServ username and password. The token will be stored in the account params object.

Clone this wiki locally