ZeroMQ.js


ZeroMQ logo

The ZeroMQ project describes ØMQ as an open-source universal messaging library. It provides an embeddable networking library with the shape of a concurrency framework: atomic messages, asynchronous I/O, multiple transports, and patterns such as pub-sub, push-pull, and request-reply.

My work in this ecosystem is focused on ZeroMQ.js, the Node.js binding that brings those ideas to modern JavaScript and TypeScript applications. I have been maintaining ZeroMQ.js since version 5.

For version 6, I revamped ZeroMQ.js in modern C++ through N-API and built the infrastructure needed to ship it reliably across platforms and architectures:

  • Prebuilt binaries across Linux x64/arm64, musl/Alpine, macOS arm64/Intel, and Windows x64/ARM/ia32.
  • Automatic CI builds for all supported platform and architecture combinations.
  • Cross-compilation for non-native architectures such as Linux ARM in Docker.
  • Reliability improvements across the native binding, packaging, and release process.

cmake-ts

cmake-ts is the closely related project I created specifically to build ZeroMQ.js with CMake and support cross-compilation. It is an all-in-one build tool for Node.js addons, designed to prebuild and ship native addons for different Node.js and Electron runtimes.

A modern Node.js API

ZeroMQ.js uses async/await and async iterators while keeping the socket model familiar to ZeroMQ users. It supports request/reply, push/pull, and publish/subscribe patterns with a TypeScript-ready API, while ZeroMQ itself can carry messages over in-process, inter-process, TCP, multicast, and WebSocket transports.

Used by major tools

ZeroMQ.js is used by major projects such as Microsoft VS Code and Jupyter notebooks, bringing the same native messaging foundation to the Node.js applications around them.

How messages move

The application sends multipart message frames to a typed socket. ZeroMQ queues and routes those frames, then passes them through the selected transport to a compatible receiving socket. The application on the other side receives the message without having to manage the transport-level I/O itself.

Diagram of ZeroMQ message frames moving between socket patterns over multiple transports

Native capabilities with a JavaScript interface

  • Native ZeroMQ performance through Node-API bindings.
  • Prebuilt binaries for common Windows, Linux, and macOS environments, with a source-build path when needed.
  • ZeroMQ 4 and 5 compatibility through zeromq/v5-compat.
  • Curve security through Libsodium and support for ZeroMQ Draft APIs.
  • Optional WebSocket, secure WebSocket, and shared-system-library configurations.

Related Links: