Application

(c) 2013-2014 http://ircanywhere.com

Author: Ricki Hastings

IRCAnywhere server/app.js

class Application.Application()

The applications’s main object, contains all the startup functions. All of the objects contained in this prototype are extendable by standard rules.

Examples:

application.post('init', function(next) {
    console.log('do something after init() is run');
    next();
});
Returns:void
Application.verbose

A flag to determine whether verbose logging is enabled or not

Type:boolean
Application.packagejson

A copy of the project’s package.json object

Type:object
Application.init()

This is the main entry point for the application, it should NOT be called under any circumstances. However it can safely be extended by hooking onto the front or back of it using pre and post hooks. Treat this method like the main() function in a C application.

Returns:void
Application.cleanCollections()

Clean channelUsers and events collection if needed. Usually when someone has installed 0.1-beta before installing this version and has incompatible data lingering around.

Returns:void
Application.setupOplog()

This method initiates the oplog tailing query which will look for any incoming changes on the database. Incoming changes are then handled and sent to the global event emitter where other classes and modules can listen to for inserts, updates and deletes to a collection to do what they wish with the changes.

Returns:void
Application.setupWinston()

This function sets up our winston logging levels and transports. You can safely extend or override this function and re-run it to re-initiate the winston loggers if you want to change the transport to send to loggly or something via a plugin.

Returns:void
Application.handleError()

Handle things such as domain errors and properly report

Returns:void
Application.setupNode()

Checks for a node record to store in the file system and database This is done to generate a ‘unique’ but always the same ID to identify the system so we can make way for clustering in the future.

Returns:void
Application.selectCipherSuite()

This function will select a suitable cipher suite and return a string to be used in createServer

Returns:void
Application.setupServer()

This function is responsible for setting up the express webserver we use to serve the static files and the sock.js server which hooks onto it to handle the websockets. None of the routes or rpc callbacks are handled here.

Returns:void