
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
lightweight bidirectional JSON RPC over Websocket
npm install jwrpc
const WebSocket = require('ws');
const JwRPC = require('jwrpc');
const wss = new WebSocket.Server({ port: 3434 });
const serverMethods = {
'greet' : new JwRPC.MethodInfo(RPC_greet),
'echo' : new JwRPC.MethodInfo(RPC_echo),
'divide' : new JwRPC.MethodInfo(RPC_divide),
};
function RPC_greet(peer, params, callback){
console.log({params});
//for notification calling 'callback' is optional
}
function RPC_echo(peer, params, callback){
console.log({params});
//send the 'params' back to client
callback(null, params);
}
function RPC_divide(peer, params, callback){
console.log({params});
if(params[1] === 0)
return callback({code:1, message:'divide by zero'});
callback(null, params[0] / params[1]);
}
wss.on('connection', function (ws) {
console.log('new connection accepted');
ws.conn = new JwRPC(ws, serverMethods);
});
const WebSocket = require('ws');
const JwRPC = require('jwrpc');
const ws = new WebSocket('ws://localhost:3434');
ws.on('open', function open() {
const conn = new JwRPC(ws, {});
//send a notification to server
conn.Notify('greet', 'hi');
//send a request to server.
conn.Request('divide', [8, 2]).then(function(divideResult){
console.log({divideResult}); //prints 4
});
//send a request to server.
conn.Request('divide', [8, 0]).catch(function(divideError){
console.log({divideError}); //prints error. divide by zero.
});
//
conn.Request('echo', 'hello world').then(function(echoResult){
console.log({echoResult}); //prints 'hello world'
});
});
FAQs
bidirectional rpc using Websocket and JSON
We found that jwrpc 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

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.