Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
pomelo-rpc
Advanced tools
pomelo-rpc is the low level RPC framework for pomelo project. It contains two parts: client and server.
#pomelo-rpc - rpc framework for pomelo
pomelo-rpc is the low level RPC framework for pomelo project. It contains two parts: client and server.
The client part generates the RPC client proxy, routes the message to the appropriate remote server and manages the network communications. Support add proxies and remote server information dynamically.
The server part exports the remote services, dispatches the remote requests to the services and also manages the network communications.
And the remote service codes would loaded by pomelo-loader module and more details please access this link.
##Installation
npm install pomelo-rpc
##Usage ###Server
var Server = require('pomelo-rpc').server;
// remote service path info list
var paths = [
{namespace: 'user', path: __dirname + '/remote/test'}
];
var port = 3333;
var server = Server.create({paths: paths, port: port});
server.start();
console.log('rpc server started.');
###Client
var Client = require('pomelo-rpc').client;
// remote service interface path info list
var records = [
{namespace: 'user', serverType: 'test', path: __dirname + '/remote/test'}
];
// server info list
var servers = [
{id: 'test-server-1', serverType: 'test', host: '127.0.0.1', port: 3333}
];
// route parameter passed to route function
var routeParam = null;
// route context passed to route function
var routeContext = servers;
// route function to caculate the remote server id
var routeFunc = function(routeParam, msg, routeContext, cb) {
cb(null, routeContext[0].id);
};
var client = Client.create({routeContext: routeContext, router: routeFunc});
client.start(function(err) {
console.log('rpc client start ok.');
client.addProxies(records);
client.addServers(servers);
client.proxies.user.test.service.echo(routeParam, 'hello', function(err, resp) {
if(err) {
console.error(err.stack);
}
console.log(resp);
});
});
##Server API ###Server.create(opts) Create a RPC server instance. Intitiate the instance and acceptor with the configure. ###Parameters
###server.start Start the remote server instance.
###server.stop Stop the remote server instance and the acceptor.
###Acceptor Implement the low level network communication with specified protocol. Customize the protocol by passing an acceptorFactory to return different acceptors.
###acceptor.listen(port) Listen the specified port.
###acceptor.close Stop the acceptor.
##Client API ###Client.create(opts) Create an RPC client instance which would generate proxies for the RPC client. ####Parameters
###client.addProxies(records) Load new proxy codes. ####Parameters
###client.addServers(servers) Add new remote server informations. ####Parameters
###client.start(cb) Start the RPC client.
###client.stop Stop the RPC client and stop all the mail box connections to remote servers.
###client.rpcInvoke(serverId, msg, cb) Invoke an RPC request. ####Parameters
###MailBox Implement the low level network communication with remote server. A mail box instance stands for a remote server. Customize the protocol by passing a mailBoxFactory parameter to client to return different mail box instances.
###mailbox.connect(cb) Connect to the remote server.
###mailbox.close Close mail box instance and disconnect with the remote server.
###mailbox.send(msg, opts, cb) Send the RPC message to the associated remote server. ####Parameters
FAQs
pomelo-rpc is the low level RPC framework for pomelo project. It contains two parts: client and server.
The npm package pomelo-rpc receives a total of 66 weekly downloads. As such, pomelo-rpc popularity was classified as not popular.
We found that pomelo-rpc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.