Library / SDK
zeromq/libzmq avatar
zeromq/libzmq

libzmq: the C++ messaging kernel behind ZeroMQ sockets

ZeroMQ core engine in C++, implements ZMTP/3.1

11,003 stars2,490 forksC++MPL-2.0

At a glance

What is it?
libzmq implements ZMTP/3.1 and gives plain sockets message queues, patterns and multiple transports. Here is what it does, how to build it, and where it stops being the right choice.
Who is it for?
Adopt libzmq when you need brokerless message patterns in C++ or from a language binding, and when you can build or package a native library yourself. Do not adopt it if you need durable queues, message replay or a central place to inspect traffic; those are broker features and libzmq does not provide them.
Can I use it commercially?
Yes, with conditions. MPL-2.0 is a weak copyleft licence: you can use it inside commercial and closed-source software, but if you distribute changes to its own files, you must publish those changes under the same licence.
Is it still maintained?
Yes. The repository last received commits 65 days ago.
What is it written in?
Mainly C++, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What libzmq adds on top of a socket

A raw TCP or IPC socket gives you a byte stream. libzmq gives you messages. The README describes the library as extending "the standard socket interfaces with features traditionally provided by specialised messaging middleware products", and the list is concrete: asynchronous message queues, several messaging patterns, message filtering through subscriptions, and access to multiple transport protocols from one API.

The intended audience is systems programmers. The core is C++, and the repository ships include/, src/, tests/, unittests/, perf/ and tools/ alongside autotools and CMake build files. You are expected to link a native library, not to run a daemon. That is the whole point of the design: there is no broker process to deploy, configure or keep alive. Two processes that speak ZMTP over TCP are the entire system.

This matters most where a broker would be a liability. A market data feed fanning out to in-process consumers, a compute cluster distributing work to workers, a set of services that need request/reply without a central hop: all of these are shapes libzmq was built for. It is a poor fit for anything that needs a durable log, because nothing in the library stores messages for you.

ZMTP/3.1, patterns and transports: the actual mechanism

libzmq's wire protocol is ZMTP/3.1, which the repository description names directly. ZMTP is a framing and handshake protocol: peers exchange greetings and metadata, then frames. Above that framing, libzmq exposes messaging patterns. The README lists asynchronous message queues, multiple messaging patterns and message filtering as the features it adds, and the repository topics name the common ones: pubsub, pushpull, stream.

The patterns are the API's real content. A publisher socket fans messages out to subscribers; a push socket distributes work to pull sockets; request and reply pair up. The pattern is chosen by socket type at construction time, and libzmq enforces the matching rules internally rather than leaving them to you. That is a different model from a socket library where every endpoint is interchangeable.

Filtering happens at the subscriber. The README calls it "message filtering (subscriptions)", so a subscriber expresses interest in a prefix and the library drops what does not match. Transports are selected by the address string rather than by separate APIs, which is how one code path can reach TCP, IPC and the other transports the build was configured with. Optional transports and security mechanisms are compile-time decisions: the Dockerfile in the repository configures with --with-libsodium and --with-libgssapi_krb5, and the CI table lists GSSAPI, PGM, NORM and TIPC as extras on specific platform rows. If your build did not enable them, the corresponding addresses will not work.

Building libzmq on Ubuntu or Windows

The repository provides two build paths, autotools and CMake, and the README states that configuration uses either. The Dockerfile is the clearest worked example of the autotools route on Debian, and it is worth reading as an install recipe even if you do not use Docker. It installs the build prerequisites, runs autogen.sh, configures with libsodium and GSSAPI, then makes, checks and installs.

bash
apt-get install -qq --yes --no-install-recommends \
    autoconf automake build-essential git \
    libkrb5-dev libsodium-dev libtool pkg-config
./autogen.sh
./configure --prefix=/usr/local --with-libsodium --with-libgssapi_krb5
make && make check && make install

After the install step the Dockerfile runs ldconfig and greps the linker cache for libzmq, which is how you confirm the shared library landed where the loader can find it. On the runtime image the same file installs libkrb5-dev and libsodium23 and copies /usr/local from the builder stage. That split is the practical lesson: the build dependencies and the runtime dependencies are not the same set.

For Windows, the CI table lists Visual Studio 2008 through 2017 on Windows Server 2012 R2 and 2016, all built with CMake, and marks several of those rows DRAFT. The README does not give a step-by-step Windows build, so the reliable source is CMakeLists.txt in the repository root. If you need a prebuilt libzmq.dll rather than a source build, the README does not document a download location; the homepage is the place it points to.

Once the library is installed, the smallest useful thing to check is that a program links and runs. The repository keeps examples under tests/ and perf/, and the README offers no standalone hello-world, so a first real use means compiling one of those test programs against your installed headers and library. If that binary starts and connects two sockets, your build is sound.

Where libzmq is the wrong tool

The library is a transport and pattern layer, not a messaging system. Nothing in the repository describes persistence, replay, dead-letter handling or a management interface. If a consumer is offline when a publisher sends, the message is gone; that is pub/sub behaviour, not a bug. Teams that need an audit trail or at-least-once delivery with recovery are looking for a broker, and libzmq will not grow into one.

Build configuration is the second trap. Optional features are compile-time flags, so two machines can have the same libzmq version and still disagree about which transports and security mechanisms exist. The CI table makes this visible: GSSAPI, PGM, NORM and TIPC appear on some rows and not others. A deployment that assumes a transport is present because it works on the developer's machine will fail at the address string, not at link time.

The third issue is release cadence. The most recent release listed is v4.3.5 from 2023-10-09, and the two before it are v4.3.4 from 2021-01-17 and v4.3.3 from 2020-09-07. The repository itself is not archived and the last push was on 2026-07-26, so development continues on master, but anyone pinning to a tagged release should understand that the tag is old relative to the commit history. Whether that matters depends on whether you need a fix that only exists on master.

libzmq compared with a broker-based stack

The natural alternative for many teams is a broker such as RabbitMQ or Kafka, or a protocol stack such as MQTT with its own broker. The difference is architectural, not cosmetic. With libzmq, every process links the library and peers connect directly; there is no component in the middle to route, buffer or authenticate. With a broker, that middle component exists and does all three.

That trade is easy to state. Brokerless means fewer moving parts, no extra network hop, and no operational surface beyond your own processes. It also means no central place to observe traffic, no queue that survives a consumer restart, and no built-in access control layer. If your requirements include any of those, the broker is not overhead, it is the feature.

Within the ZeroMQ ecosystem there is also a distinction worth keeping straight: libzmq is the C++ core, while cppzmq is a separate C++ header-only binding that wraps it. The related searches around "libzmq vs cppzmq" reflect that confusion. They are not competing engines; one is the library and the other is a friendlier C++ interface to it. Similarly, czmq is a higher-level C binding, and language bindings for Python, Java and others sit on top of the same core. Choosing a binding does not change the wire protocol or the pattern semantics.

Licence and the cost of keeping up

libzmq is licensed under MPL-2.0. That is a file-level copyleft licence: modifications to MPL-covered files carry obligations, while larger works that combine libzmq with your own files are treated differently. How that applies to statically linking a modified libzmq into a closed product is a question for your legal team, not for this article; the LICENSE file in the repository root is the authoritative text.

The maintenance cost is mostly build-system cost. You inherit autotools and CMake, a set of optional dependencies that vary by platform, and a CI matrix that spans Ubuntu, Windows, macOS, CentOS, Debian, Fedora, RHEL, SuSE and Android NDK. If you consume a distribution package, the distro decides which optional features are on; if you build from source, you decide, and you own the result. Upgrading means re-running configure with the same flags and re-checking that your transport assumptions still hold. The NEWS file is where version-to-version changes are recorded; the README does not document a rollback path, so plan to keep the previous build artefacts until the new one is verified.

Editorial conclusion

Adopt libzmq when you need brokerless message patterns in C++ or from a language binding, and when you can build or package a native library yourself. Do not adopt it if you need durable queues, message replay or a central place to inspect traffic; those are broker features and libzmq does not provide them. Before committing, verify that your toolchain can build the current master or a 4.3.x release, check whether the language binding you plan to use tracks the same version, and confirm which optional dependencies (libsodium, GSSAPI, PGM, NORM, TIPC) your build actually needs.

Frequently asked questions

Is ZeroMQ still used?

The repository is not archived and the last push was on 2026-07-26, so development on master continues. The most recent tagged release is v4.3.5 from 2023-10-09, which means the project's release cadence is slower than its commit activity.

What is libzmq?

libzmq is the ZeroMQ core engine written in C++, implementing ZMTP/3.1. The README describes it as a lightweight messaging kernel that extends standard socket interfaces with asynchronous message queues, messaging patterns, subscription filtering and multiple transports.

How to install libzmq?

The repository supports autotools and CMake. The Dockerfile shows the autotools path: install the build dependencies, run ./autogen.sh, then ./configure --prefix=/usr/local --with-libsodium --with-libgssapi_krb5, followed by make, make check and make install. On Windows the CI table lists CMake builds with Visual Studio.

What are the key differences between ZeroMQ and MQTT?

The repository does not compare libzmq with MQTT, so no reliable difference can be stated here. What libzmq documents is a brokerless library: processes link it and peers connect directly over transports including TCP and IPC.

Which is better for messaging, gRPC or ZeroMQ?

The repository does not discuss gRPC, so this comparison cannot be answered from the available documentation. libzmq's own scope is messaging patterns such as pubsub, pushpull and stream over ZMTP/3.1.

libzmq vs czmq: what is the difference?

libzmq is the C++ core engine, and czmq is a separate higher-level C binding that sits on top of it. They are not competing engines; the wire protocol and pattern semantics come from libzmq either way.

Official sources

  1. License: MPL-2.0
  2. Project website
  3. README
  4. Releases
  5. zeromq/libzmq on GitHub
For maintainers

Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/zeromq-libzmq.svg)](https://hysenlabs.com/projects/zeromq-libzmq)
Community notes

Community notes