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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@azuliani/node-service

v0.0.2

Published

Node.js library for building services with ZeroMQ-based messaging patterns

Readme

node-service

Node.js library for building services with ZeroMQ-based messaging patterns. Provides both Service (server) and Client abstractions for different communication patterns.

Installation

npm install @azuliani/node-service

Quick Start

const { Service, Client } = require('@azuliani/node-service');

// Define a descriptor
const descriptor = {
  transports: {
    rpc: { client: "tcp://127.0.0.1:5555", server: "tcp://127.0.0.1:5555" }
  },
  endpoints: [
    { name: "Echo", type: "RPC", requestSchema: { type: "string" }, replySchema: { type: "string" } }
  ]
};

// Create a service
const service = new Service(descriptor, {
  Echo: (request) => request  // Echo handler
});

// Create a client
const client = new Client(descriptor);
const reply = await client.Echo("Hello");
console.log(reply);  // "Hello"

Service Types

Services are servers that expose endpoints. Created via new Service(descriptor, handlers, initials, options).

| Type | Description | |------|-------------| | RPCService | Request/response pattern over ZMQ dealer/router | | SourceService | Publishes messages to subscribers (ZMQ pub socket) | | SinkService | Receives messages from clients (ZMQ pull socket) | | PushService | Pushes messages to workers (ZMQ push socket) | | SharedObjectService | Syncs object state to clients via diffs |

Service Options

  • heartbeatMs - Heartbeat interval in milliseconds (default: 5000)

Client Types

Clients connect to services. Created via new Client(descriptor, options).

| Type | Description | |------|-------------| | RPCClient | Calls RPC endpoints with timeout support | | SourceClient | Subscribes to source messages (ZMQ sub socket) | | SinkClient | Sends messages to sink (ZMQ push socket) | | PullClient | Receives pushed messages (ZMQ pull socket) | | SharedObjectClient | Maintains synchronized copy of server's SharedObject |

Client Options

  • initDelay - Delay in ms before SharedObjectClient fetches full state after subscribe (default: 100)

Descriptor Format

Both Service and Client use the same descriptor object:

{
  transports: {
    source: { client: "tcp://...", server: "tcp://..." },
    sink:   { client: "tcp://...", server: "tcp://..." },
    rpc:    { client: "tcp://...", server: "tcp://..." },
    pushpull: { client: "tcp://...", server: "tcp://..." }
  },
  endpoints: [
    { name: "MyRPC", type: "RPC", requestSchema: {...}, replySchema: {...} },
    { name: "MySource", type: "Source", messageSchema: {...} },
    { name: "MySO", type: "SharedObject", objectSchema: {...} }
  ]
}

Schema Validation

Schema validation using schema-inspector. Schemas support:

  • Standard types: string, number, object, array
  • Special type date for automatic Date parsing from JSON
  • Wildcard * in object properties for dynamic keys
  • Set skip: true on schema to bypass validation

Heartbeat System

Services automatically send heartbeat messages on the source transport. Clients detect disconnection when no messages arrive within 3x the heartbeat interval.

  • Client learns heartbeat frequency from the first heartbeat message
  • Heartbeat timeout triggers automatic disconnect/reconnect cycle
  • On disconnect, SharedObjectClient emits synthetic deletion diffs before flushing data

Lifecycle

Both Service and Client have a close() method for proper cleanup:

service.close();  // Stops heartbeat, closes all sockets
client.close();   // Stops heartbeat checking, closes all sockets

License

MIT