Miss any of our Open RFC calls?Watch the recordings here! »

omega-supreme-rooms-middleware

1.1.6 • Public • Published

Omega Supreme Rooms Middleware

NPM version Build Status Dependencies Coverage Status

This middleware adds support for primus-rooms and automatically integrates it with metroplex if included. you MUST have primus-rooms installed.

Installation

npm install --save omega-supreme-rooms-middleware

Using the middleware

Just set the middleware in primus options so omega-primus can use it, see example below:

'use strict';
 
var Primus = require('primus')
  , server = require('http').createServer()
  , middleware = require('omega-supreme-rooms-middleware');
 
var primus = new Primus(server, {
  /* Add the options here, in the Primus's options */
});
 
primus.plugin('omega-supreme', require('omega-supreme'));
primus.options.middleware = middleware();
 
server.listen(8080);

Messaging

The middleware follows and maintains all functionality of omega-supreme. The middleware adds the ability to make requests with the following properties:

  • The rooms property can be an array or a string of room names. Message will be broadcasted to all the sparks connected to the rooms.
  • The except property can be an array or a string of spark ids. Message will not be broadcasted to the sparks in the except property. This property will only be used when rooms property is provided

Metroplex integration

The middleware automatically handles metroplex. If using metroplex and primus-rooms-redis-adapter.

Install

npm i omega-supreme-rooms-middleware

DownloadsWeekly Downloads

29

Version

1.1.6

License

MIT

Unpacked Size

9.7 kB

Total Files

4

Last publish

Collaborators

  • avatar