0.0.6 • Published 5 years ago

jrpc-client v0.0.6

Weekly downloads
-
License
-
Repository
-
Last release
5 years ago

jrpc-client

json rpc 2.0规范的客户端实现

Usage

var jrpc=new (require('jrpc-client'))();

jrpc.connect(port, ip)
	.on('error', console.log)
    .on('connect broken', function() {setTimeout(jrpc.reconnect.bind(jrpc), 1000)});

jrpc.call('some_function', args, console.log);

Update

现在可以更简单的使用jrpc了。以前的用法经常在connect broken时忘记bind(jrpc),现在修改成了传入opt

var jrpc=new (require('jrpc-client'))();
	.connect('127.0.0.1:8887');

jrpc.call('some_function', args, console.log);

opt={autoretry:ms, emitErr:boolean} autoretry默认是1000ms,emitErr默认是false

connect现在支持传入'127.0.0.1:8887'这样的字符串来连接了。