package
rpc with duplex streams using multiplex
npm install multiplex-rpcGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
rpc with multiplexed duplex streams
like rpc-with-streams but using multiplex instead of mux-demux
server:
var RPC = require('multiplex-rpc');
var net = require('net');
var fs = require('fs');
var server = net.createServer(function (stream) {
var rpc = RPC({
hello: function () {
return fs.createReadStream(__dirname + '/hello.txt');
}
});
stream.pipe(rpc).pipe(stream);
});
server.listen(5000);client:
var RPC = require('multiplex-rpc');
var net = require('net');
var rpc = RPC();
rpc.pipe(net.connect(5000)).pipe(rpc);
var client = rpc.wrap([ 'hello:s' ]);
client.hello().pipe(process.stdout);var RPC = require('multiplex-rpc')Create a new rpc duplex stream instance rpc that wraps the interface api
similarly to rpc-stream.
Create an interface client based on methods, an array of string method
names. Method names that end with :s are interpreted as duplex stream methods.
With npm do:
npm install multiplex-rpcMIT
Estimated unpacked size across 18 packages.
523.1 kB
Includes dependencies.