
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
A simple node-js-tcp publish-subscribe framework. With a broker and a client called member.
A simple node-js-tcp publish-subscribe-request-response framework :octopus:. With a broker and a client called member.
A simple and fast :leopard: exchange of data between nodejs-applications.Use the publish-subscribe-pattern to handle events or use the request-response-pattern to query or serve some data.
npm i tcppubsub
A broker handles all data from the members, like sockets, topics and payload. You can use some events do handle the member-data directly at the broker-side.
var tcppubsub = require('tcppubsub')
var port = 2223
var host = 'localhost'
var blockPublisher = false // block payload sending to publisher, if he has subscribed the topic too
var broker = new tcppubsub.Broker(port, host, blockPublisher)
broker.listen()
broker.getConnections(function(err, numb){
console.log('connected members:', numb)
})
//use the socket-events like:
broker.on('end', function(msg){console.log('end:', msg)})
broker.on('close', function(member){console.log('close:', msg)})
broker.on('error', function(err){console.log('error:', err)})
broker.on('published', function(data){console.log('published:', data)})
broker.on('subscribed', function(topic){console.log('subscribed:', topic)})
broker.on('unsubscribed', function(topic){console.log('unsubscribed:', topic)})
Call the connect-method to connect the member.
member.connect(function(){
// Use other methods like sub, unsub, pub, req, listen in here.
})
Subscribe a topic. For multiple topics give a array of topics like ['topic1', 'topic2',...].
member.sub(topic, function(topic){})
Unsubscribe a topic. For multiple topics give a array of topics like ['topic1', 'topic2',...].
member.unsub(topic)
Publish some data on a topic.
member.pub(topic, data)
Make a request on a listener topic. Set some timeout in ms for handle timeout-errors. Default-timeout: 10min.
member.req(topic, data, function(err, data, id){
if(err){
console.log(err) // timeout error
}else{
console.log(data)
}
}, timeout)
Listen on a specific topic for requests. Handle the data and send the response with res.
member.listen(topic, function(data, res){
console.log(data)
res(data)
})
var tcppubsub = require('tcppubsub')
var port = 2223
var host = 'localhost'
//Create the member
var member = new tcppubsub.Member(port, host)
member.connect(function(){
//Subscribe the topic without callback
member.sub('app/configuration/service')
// Subscribe the topic STRING or ARRAY
member.sub('app/configuration/server', function(topic){
// Publish some data STRING, OBJECT, ARRAY
member.pub('app/configuration/server', {name: 'yamigr', b : 'Hello World'})
})
// Receive the data on the certain topic
member.on('app/configuration/server', function(data){
// Unsubscribe the topic
member.unsub('app/configuration/server')
console.log('rcv publish:', data)
})
/******* OR *******/
// Receive all publishes on subscribed data
member.on('message', function(topic, data){
member.unsub('app/configuration/server')
console.log(topic, data)
})
member.listen('app/static/config', function(data, res){
res({ msg: 'Hello ' + data.name})
})
let timeout = 2000 // default 5000
member.req('app/static/config', { name : 'Peter Pan'}, function(err, data, id){
if(!err){
console.log('rcv response:', data.msg)
}
}, timeout)
})
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
A simple node-js-tcp publish-subscribe framework. With a broker and a client called member.
The npm package tcppubsub receives a total of 1 weekly downloads. As such, tcppubsub popularity was classified as not popular.
We found that tcppubsub 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.