1.2.93 • Published 8 years ago

jsonrpc-node v1.2.93

Weekly downloads
45
License
MIT
Repository
github
Last release
8 years ago

##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

###installation

npm install jsonrpc-node

###server

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("pong");
    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

net.createServer(server)

http server for express

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

###client

Include library

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

or

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){})
1.2.93

8 years ago

1.2.92

9 years ago

1.2.91

9 years ago

1.2.9

9 years ago

1.2.8

9 years ago

1.2.7

9 years ago

1.2.6

9 years ago

1.2.5

9 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.8

9 years ago

1.1.7

9 years ago

1.1.6

9 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago