A WAMP-Router implementation for node.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples Add client/server example. Sep 21, 2014
.jshintrc Initial commit with MessageParser and MessageTypes. Sep 3, 2014


Build Status ![Gitter](https://badges.gitter.im/Join Chat.svg)


A WAMP-Router implementation for node.js. At the moment, WAMP basic profile in the roles of dealer and broker are supported. For client connections: publish/subscribe and remote procedure register/call, AutobahnJS can be used.


npm install --save git+https://github.com/christian-raedel/nightlife-rabbit

##Basic Usage##

var http       = require('http')
    , CLogger  = require('node-clogger');

var nightlife  = require('nightlife')
    , autobahn = require('autobahn');

// Create a new router with given options. In this example, the options are the
// default values.
var router = nightlife.createRouter({
    httpServer: http.createServer(),                    // Nodes http or https server can be used.
                                                        // httpServer.listen() will be called from
                                                        // within router constructor.

    port: 3000,                                         // The url for client connections will be:
    path: '/nightlife',                                 // ws://localhost:3000/nightlife.

    autoCreateRealms: true,                             // If set to false, an exception will be thrown
                                                        // on connecting to a non-existent realm.

    logger: new CLogger({name: 'nightlife-router'})     // Must be an instance of 'node-clogger'.
                                                        // See http://github.com/christian-raedel/node-clogger
                                                        // for reference...

var client = new autobahn.Connection({
    url: 'ws://localhost:3000/nightlife',
    realm: 'com.example.myapp'

client.onopen = function (session) {
    // do pub/sub or some procedure calls...


##Advanced Usage##

Please see the examples directory of this repository.