
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
msgpack-rpc-lite
Advanced tools
Implementation of MessagePack-RPC with msgpack-lite
createServer([serverOptions][, codecOptions])
Creates a new MessagePack-RPC server.
serverOptions
<Object> See net.createServer([options][, connectionListener])codecOptions
<Object>
encode
See Custom Codec Optionsdecode
See Custom Codec OptionsServer event: method
Emitted when a new connection is made.
null
as the first argument and response parameters as the second argument.createClient(port[, host][, timeout][, codecOptions])
Initiates a MessagePack-RPC client.
port
<number> Port the socket should connect to.host
<string> Host the socket should connect to. Default: 'localhost'
timeout
<number> Sets the socket to timeout after timeout milliseconds of inactivity on the socket. If timeout is 0, then the existing idle timeout is disabled. Default: 0
codecOptions
<Object>
encode
See Custom Codec Optionsdecode
See Custom Codec Optionsclient.request(method[, ...args])
method
<string>client.notify(method[, ...args])
method
<string>Server
const rpc = require('msgpack-rpc-lite');
const server = rpc.createServer().on('say', (params, callback) => {
const [ message ] = params;
callback(null, `hello ${ message }`);
});
server.listen(9199);
Client
const rpc = require('msgpack-rpc-lite');
const client = rpc.createClient(9199, 'localhost');
client.request('say', [ 'world' ]).then(([ response ]) => {
console.log(response); // hello world
})
Set true
to useraw
of encode
/decode
of Codec-options.
const codecOptions = { encode: { useraw: true }, decode: { useraw: true } };
const client = rpc.createClient(9199, 'localhost', 0, codecOptions);
See also:
FAQs
Implementation of MessagePack-RPC with msgpack-lite
The npm package msgpack-rpc-lite receives a total of 34 weekly downloads. As such, msgpack-rpc-lite popularity was classified as not popular.
We found that msgpack-rpc-lite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.