1.2.93 • Published 9 years ago

jsonrpc-node v1.2.93

Weekly downloads
45
License
MIT
Repository
github
Last release
9 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

9 years ago

1.2.92

10 years ago

1.2.91

10 years ago

1.2.9

10 years ago

1.2.8

10 years ago

1.2.7

10 years ago

1.2.6

10 years ago

1.2.5

10 years ago

1.2.4

10 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.8

10 years ago

1.1.7

10 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago