Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pm2-axon

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pm2-axon

High-level messaging & socket patterns implemented in pure js

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
increased by2.91%
Maintainers
1
Weekly downloads
 
Created

What is pm2-axon?

pm2-axon is a high-performance inter-process messaging library for Node.js, designed to facilitate communication between different processes or services. It provides various messaging patterns such as push/pull, pub/sub, and req/rep, making it suitable for building scalable and distributed systems.

What are pm2-axon's main functionalities?

Push/Pull

The push/pull pattern is used for distributing tasks among multiple workers. The push socket sends messages to connected pull sockets in a round-robin fashion.

const axon = require('pm2-axon');
const push = axon.socket('push');
const pull = axon.socket('pull');
push.bind(3000);
pull.connect(3000);
pull.on('message', function(msg){
  console.log('received: %s', msg);
});
push.send('hello');

Pub/Sub

The pub/sub pattern is used for broadcasting messages to multiple subscribers. The pub socket sends messages to all connected sub sockets.

const axon = require('pm2-axon');
const pub = axon.socket('pub');
const sub = axon.socket('sub');
pub.bind(4000);
sub.connect(4000);
sub.on('message', function(msg){
  console.log('received: %s', msg);
});
pub.send('hello world');

Req/Rep

The req/rep pattern is used for request/response communication. The req socket sends a request and waits for a response from the rep socket.

const axon = require('pm2-axon');
const req = axon.socket('req');
const rep = axon.socket('rep');
req.bind(5000);
rep.connect(5000);
rep.on('message', function(msg, reply){
  console.log('received: %s', msg);
  reply('pong');
});
req.send('ping', function(res){
  console.log('reply: %s', res);
});

Other packages similar to pm2-axon

Keywords

FAQs

Package last updated on 06 Jul 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc