Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
metroplex
Advanced tools
Readme
Metroplex a Redis based spark/connection registry for Primus.
Metroplex is released in the npm registry and can therefor be installed using:
npm install --save metroplex
Once you've installed the module you need to tell Primus to use the plugin which
is done using the primus.plugin
method:
'use strict';
var http = require('http').createServer()
, Primus = require('primus')
, primus = new Primus(http, { transformer: 'sockjs' });
primus.plugin('metroplex', require('metroplex'));
In the example above you've seen how to add the plugin to your Primus server but not how to configure it. We have various of options that can be configured in this plugin:
ioredis
client.metroplex
.300000
msalive
key in Redis.
This time is subtracted from the set interval
so we update the key BEFORE
it expires. Defaults to 2000
ms.http://0.0.0.0:8080
from
it.These options should be provided in the options object of the Primus server:
primus = new Primus(http, {
transformer: 'sockjs',
namespace: 'metroplex',
redis: require('redis').createClient()
});
primus.plugin('metroplex', require('metroplex'));
The orchestration is all done using the metroplex
library which is bundled in
this plugin. The Metroplex instance is exposed on the Primus
instance when you
use this plugin:
primus.metroplex.servers(function (err, servers) {
console.log('registered servers:', servers);
});
The following public methods are available.
metroplex.servers(fn)
List all the servers in our current registry.
metroplex.servers(function (err, servers) {
console.log(servers);
});
metroplex.spark(id, fn)
Get the server for the given spark id. It does not check if the spark is hosted on the current server. That's up to the developer to implement.
metroplex.spark(id, function (err, server) {
console.log(server);
});
metroplex.sparks(sparks, fn)
Get the servers for each id in the given sparks
array. It will return an
object and just like metroplex.spark
it does not check if the spark is hosted
on the current server.
If you load the omega-supreme
plugin before metroplex
, you can use some additional convenience methods.
These methods are added to the primus.forward
object:
forward.broadcast(msg, fn)
Broadcast a message to all sparks in the cluster.
forward.broadcast('data', function (err, result) {
// result is an object with details about the result of the operation.
console.log(result);
});
forward.sparks(ids, msg, fn)
Send a message to a set of sparks in the cluster.
forward.sparks(['ad8a-280z-18', 'y97x-42480-13'], 'data', function (err, result) {
console.log(result);
});
forward.spark(id, msg, fn)
Send a message to a single spark in the cluster.
forward.spark('ad8a-280z-18', 'data', function (err, result) {
console.log(result);
});
FAQs
Metroplex is capable of transforming into a battle station, giant robot or a distributed connect client directory for Primus.
The npm package metroplex receives a total of 129 weekly downloads. As such, metroplex popularity was classified as not popular.
We found that metroplex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.