1.4.4 • Published 9 years ago

yajrpc v1.4.4

Weekly downloads
26
License
ISC
Repository
github
Last release
9 years ago

YAJRPC

TRAVIS NPM

js-standard-style

Yet another JSON RPC (Client)

Example

let Yajrpc = require('yajrpc')
let rpc = new YajRPC({
  url: 'http://localhost:8332',
  user: process.env.RPCUSER,
  pass: process.env.RPCPASSWORD
})

// 1 call
rpc.call('func1', [1, 2, 3], (err, result) => {
	// ...
})

// batched request
rpc.batch([{
	method: 'func1',
	params: [1, 2, 3],
	callback: (err, result) => {
		// ...
	}
}, ...], function (err) { ... })

The batch method is remarkably useful in high-performance applications when used with tools like qup:

let qup = require('qup')
let Yajrpc = require('yajrpc')

let client = new Yajrpc({
  url: process.env.RPC,
  user: process.env.RPCUSER,
  pass: process.env.RPCPASSWORD
})

// group RPC calls into batches of RPCBATCHSIZE, with a maximum of RPCCONCURRENT batches simultaneously
let q = qup((batch, callback) => {
  client.batch(batch, callback)
}, process.env.RPCCONCURRENT, process.env.RPCBATCHSIZE)

function rpc (method, params, callback) {
  q.push({ method, params, callback })
}

rpc('func1', [1, 2, 3], ...)

See yajrpc/qup for a pre-made equivalent of the above.

LICENSE ISC

1.4.4

9 years ago

1.4.3

9 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.1

9 years ago

1.3.0

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

10 years ago

1.1.4

10 years ago

1.1.3

11 years ago

1.1.2

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago