API Reference
zeromq.js
Node.js bindings for ZeroMQ, providing messaging sockets such as REQ, REP, PUB, and SUB.
Official Documentation ↗CompatibilityThis documentation covers version
v6. Check the official docs for the latest API surface.Installation
npm
npm install zeromqMethods
No methods match this filter.
zeromq.js exposes ZeroMQ socket patterns for building brokerless, high-throughput messaging topologies.
Key Features
- Multiple messaging patterns in one library
- Async iterator receive support
- Bind and connect with TCP or IPC
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Security
Official security statements captured from the package documentation:
- 官方 README 声明内置 CURVE 加密传输(依赖 libsodium) — “Secure Curve protocol with Libsodium” (source: https://zeromq.github.io/zeromq.js/, fetched 2026-11-08T20:29:00+08:00)
- 设置 plainPassword 非空即把连接的安全机制切换为 PLAIN — “Sets the password for outgoing connections over TCP or IPC. If you set this to a non-null value, the security mechanism used for connections shall be PLAIN.” (source: https://zeromq.github.io/zeromq.js/classes/Publisher.html, fetched 2026-11-08T20:29:00+08:00)
- curveServer 决定套接字是否充当 CURVE 服务端 — “Defines whether the socket will act as server for CURVE security. A value of
truemeans the socket will act as CURVE server. A value offalsemeans the socket will not act as CURVE server, and its security role then depends on other option settings.” (source: https://zeromq.github.io/zeromq.js/classes/Publisher.html, fetched 2026-11-08T20:29:00+08:00) - 绑定网络接口(Linux)需要 root 或 CAP_NET_RAW 权限 — “Binds the socket to the given network interface (Linux only). Allows to use Linux VRF, see: https://www.kernel.org/doc/Documentation/networking/vrf.txt. Requires the program to be ran as root or with
CAP_NET_RAW.” (source: https://zeromq.github.io/zeromq.js/classes/Publisher.html, fetched 2026-11-08T20:29:00+08:00)
API reference evidence
Fetched from official sources on 2026-11-08T20:29:00+08:00 via WebFetch https://zeromq.github.io/zeromq.js/(官方站点,渲染仓库 README);WebFetch https://zeromq.github.io/zeromq.js/classes/Publisher.html(官方 typedoc API reference).
new Publisher→ signature from https://zeromq.github.io/zeromq.js/classes/Publisher.html; official text: “- new Publisher( options?: { affinity?: number; backlog?: number; conflate?: boolean; connectTimeout?: number; context?: Context; curvePublicKey?: null |string; “
FAQ
- How is ZeroMQ different from a message broker?
- ZeroMQ is a library, not a server. It provides patterns and transport but no persistence or central broker, so durability is your responsibility.
- What does subscribe with an empty string do?
- An empty subscription prefix matches all messages; pass a topic prefix to receive only messages starting with it.
- Does it support multiple frames?
- Yes. Arrays of Buffers or strings are sent as multipart messages and arrive as separate frames on the receiver.
Report a problem with this API docOpens a pre-filled issue on GitHub.