Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

A middleware for omega-supreme that adds support for primus-rooms and metroplex

Notifications You must be signed in to change notification settings

fadeenk/omega-supreme-rooms-middleware

Repository files navigation

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.

About

A middleware for omega-supreme that adds support for primus-rooms and metroplex

Resources

Stars

Watchers

Forks

Packages

No packages published