npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zmq-json-rpc-server

v0.0.1

Published

JSON-RPC 2.0 server implementation using a ZMQ socket as transport mechanism

Downloads

3

Readme

ZMQ JSON-RPC Server

JSON-RPC 2.0 server implementation using a ZeroMQ socket as transport mechanism. More precisely a router socket is used for the server, in line with the asynchronous clients / servers pattern of ZeroMQ.

For corresponding client implementation, see zmq-json-rpc-client.

Installation

npm install zmq-json-rpc-server

Usage

Create a JSON RPC server with a ZeroMQ endpoint and receive requests or notifications.

server = zmqJsonRpcServer(endpoint, options)

This module exports a factory faction that accepts a ZeroMQ endpoint, eg. 'tcp:127.0.0.1:3030' and options.

Options

Options can be passed to the factory function as an object, specified by the following key and value.

ignoreVersion

Value: Boolean indicating if server should ignore the jsonrpc member in the request. Defaults to false.

server.on(method, callback)

Listens for a JSON-RPC request or notification. The callback will receive params and reply arguments. The reply argument is a noop if the client sends a notification (ie. request without an id member). The reply argument should be called with arguments error and result when replying to a request.

server.socket

Exposes the underlying ZeroMQ socket object.

Example


var zmqJsonRpcServer = require('zmq-json-rpc-server');
var server = zmqJsonRpcServer('tcp:127.0.0.1');

// Listen for a notification
server.on('update', function(params) {
  // ..  
});

// Listen for a request and send reply
server.on('subtract', function(params, reply) {
  reply(null, params.minuend - params.subtrahend);
});

// Exiting application
process.on('SIGINT', function() {
  server.socket.close();
});

Test

Run unit tests:

$ npm test

License

MIT