
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
pub-sub-handler
Advanced tools
This was written to be used with Redis as a Publish/Subscribe handler. It is just a wrapper designed to help with managing sockets.
var psh = require( 'pub-sub-handler' )( { host: localhost, port: 6379 }, function( channel ){
// Called when the backend Redis makes a subscription
};
psh.subscribe( 'channel-name', 'key', object, function( channel, key, object, message ){
// Called when a message is published to the specified channel
};
psh.publish( 'channel-name', 'message' );
psh.unsubscribe( 'channel-name', 'key' );
(kill the Redis connections)
psh.end();
A typical use would be the key is a user id and the object is a socket. User connects to a web socket, you subscribe to a specified channel with the user id as a key and pass in the socket as the object. Then in your handler, when a message is published to the channel you have the socket to write the message to.
FAQs
Redis Pub/Sub with an object & key on message.
The npm package pub-sub-handler receives a total of 0 weekly downloads. As such, pub-sub-handler popularity was classified as not popular.
We found that pub-sub-handler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.