NN_BUS(7)

πŸ“¦
version 1.2.2 Β· 5 versions
, in fedora 44

✨ nn_bus β€” the message bus scalability protocol, bestie πŸ’…

okay so this is the nn_bus page from the nanomsg manual, version 1.2.2, and it's literally the blueprint for making a whole lil crew of nodes gossip with each other. sit down, grab a boba, we're doing topologies πŸ§‹βœ¨


🌸 SYNOPSIS 🌸

#include <nanomsg/nn.h>

#include <nanomsg/bus.h>

that's it. two includes. she's low maintenance πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so the vibe here is broadcast: messages get sent from any node and land at all the other nodes in the topology. that's the whole personality.

important: the socket should never receive a message that it sent itself. no self-DMs, not even accidentally πŸ™ˆ

this pattern only scales to the local level β€” think one single machine, or one single LAN. and fr fr, don't try to push it further than that, because trying to scale it bigger can end up overloading individual nodes with messages. it's giving main character burnout 😭

⚠️ Warning for the bus topology to actually function correctly, the user is responsible for making sure that a path exists from each node to any other node within the topology. nobody's gonna hold your hand on this one β€” you build the roads, bestie πŸ›£οΈ

also! a raw (AF_SP_RAW) BUS socket never sends the message to the peer it was received from. so no awkward boomerang messages, we love that for her ✨


πŸ¦‹ Socket Types πŸ¦‹

  • NN_BUS β€” messages you send get distributed to all nodes in the topology. and incoming messages from all the other nodes in the topology are fair-queued in the socket. everybody gets a turn, no queue-jumping, we stan fairness πŸ’–

πŸŽ€ Socket Options πŸŽ€

there are no options defined at the moment. zero. none. a clean slate, an empty group chat, iconic honestly πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, iykyk πŸ“š


🌈 AUTHORS 🌈

Martin Sustrik <sustrik@250bpm.com> β€” the actual legend who wrote this 🫢


and that's a wrap on nn_bus(7) from nanomsg 1.2.2, dated 2026-01-16 β€” go build your bus, bestie, and remember: connect every node or the whole thing falls apart. mwah πŸ’‹

πŸ“¦ where this page comes from