JSON RPC client/server with multiple transport types : TCP, HTTP, Middleware and SSL support
Last updated 2 years ago by kenhuang .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jsonrpc-node-commit 
SYNC missed versions from official npm registry.

##JsonRPC-Node Multi transport JSON-RPC client/server with SSL support for node.js

Can be used as stand alone server or as net.Server/express middleware


npm install jsonrpc-node


Include library

Server = require("jsonrpc-node").TCP.Server;

or over http

Server = require("jsonrpc-node").HTTP.Server;

Create server object

var server = new Server({echo:function(args, reply){return reply(args);}});

or without arguments

var server = new Server();

Register some methods

server.register("ping", function(args, reply){
    reply.notify("pong2"); //data can be streamed

or bulk register

server.register({ping:function(args, reply){reply("pong");}, time:function(args, reply){return reply.error("some error");}});

Start listening

server.listen(3001, "localhost")

or use SSL connection

server.listenSSL(3001, "localhost","key.pem","cert.pem");

or can be used as middleware,

tcp server for net.Server


http server for express

var app = express();
app.use("/api", server);


Include library

Client = require("jsonrpc-node").TCP.Client;


Client = require("jsonrpc-node").HTTP.Client;

Create client object

client = new Client(3001, "localhost");

Execute remote methods

client.call("multiply", [1,2,4], function(err, result){})

Current Tags

  • 1.2.93                                ...           latest (2 years ago)

1 Versions

  • 1.2.93                                ...           2 years ago
Maintainers (1)
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |