lp

locomotive-primus

Locomotive handlers for Primus WebSockets abstraction layer

Showing:

Popularity

Downloads/wk

8

GitHub Stars

3

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

2

Size (min+gzip)

4.9KB

License

Apache-2.0

Type Definitions

Tree-Shakeable

No?

Categories

Readme

locomotive-primus

Locomotive handlers for Primus WebSockets abstraction layer

Installation

$ npm install locomotive-primus

How it works

This module works by exposing server in your locomotive app. It becomes available in this.server.

Simple http or cluster, this implementation is included too, just swap the primusLocomotive.boot.httpServer to primusLocomotive.boot.httpServerCluster

The module boots primus using the provided options and this.server and then exposes primus globally in this.primus

Quick Start

In your locomotive server.js file, use the following code.

var primusLocomotive = require('locomotive-primus');
var Primus = require('primus');
...


app.phase(primusLocomotive.boot.httpServer(3000, '0.0.0.0'));
app.phase(primusLocomotive.boot.primusServer(Primus, {
    primus: {
        primus configuration here
    },
    clientLocation: path.resolve(__dirname + '/public/js/libs/primus-client.js'),
    authorizeFunction: function() { return "your primus authorize function, or null if you don't need one"; },
    sparkHandler: function(spark) { return "your spark handler"; }
}));


Misc

A more comprehensive documentation will be included later

Credits

License

Apache 2.0

Bitdeli Badge

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100