NNG_RESPONDENT(7)
π NNG_RESPONDENT β¨
okay bestie, welcome to the NNG Reference Manual β this is the page for nng_respondent, the respondent protocol, and we're gonna make it make sense fr fr π
πΈ NAME πΈ
nng_respondent β the respondent protocol, aka the one that answers back π«Ά
β¨ SYNOPSIS β¨
#include <nng/protocol/survey0/respond.h>
like, that's the whole vibe up top, include the header and you're in π
π¦ DESCRIPTION π¦
So the respondent protocol? It's one half of the survey pattern, periodt. Here's how the whole thing goes down:
A surveyor sends out a survey, and that survey gets broadcast to all peer respondents. Then each respondent gets a chance to reply β but here's the thing, they're not obliged to reply. No pressure, no rush, do what feels right π
And the survey itself? It's a timed event, so any responses that come in after the survey has finished are discarded. Time's up, doors closed, nothing to see here π
Tip β this protocol is lowkey iconic for solving voting problems, like leader election in cluster configurations, and also certain kinds of service discovery problems. slay.
And just to be clear on who's who: the respondent protocol is the respondent side, and the surveyor protocol (nng_surveyor) is the surveyor side. Two halves of one gorgeous whole π
π Socket Operations π
The nng_respondent0_open() functions create a respondent socket. What do you do with it? You receive messages, and then you send replies β¨
One rule though: a reply can only be sent after receiving a survey, and generally that reply goes to the surveyor from whom the last survey was received. iykyk π
Also, respondents can totally discard a survey β you just do it by simply not replying to it. ghosting, but make it protocol-legal π
Heads up: Raw mode sockets (set with NNG_OPT_RAW) ignore all these restrictions. no rules, no limits, main character energy.
π Context Operations π
This protocol supports creating contexts for concurrent use cases via nng_ctx_open(). Very demure, very parallel β¨
Here's the tea:
- Incoming surveys will be routed to and received by only one context.
- Additional surveys may be received by other contexts in parallel β multitasking queen π
- Replies made using a context will be returned to the surveyor that issued the survey most recently received by that context.
- The restrictions for order of operations with sockets apply equally well for contexts, except that each context is treated as if it were a separate socket.
π§ Protocol Versions π§
Only version 0 of this protocol is supported. (At the time of writing, no other versions of this protocol have been defined. An earlier and incompatible version of the protocol was used in older pre-releases of nanomsg http://nanomsg.org, but it was not released in any production version.) so like, don't come at us with the ancient lore π
β Protocol Options β
The respondent protocol has no protocol-specific options. that's it, that's the section, nothing to configure bestie π
π Protocol Headers π
The respondent protocol uses a backtrace in the header. This is more fully documented in the surveyor manual β go read that one too, it's giving lore π¦
π SEE ALSO π
and that's the whole page, bestie!! go forth and respond responsibly π«Άπ
mwah π β this was NNG_RESPONDENT(7) from the NNG Reference Manual, dated 2026-06-30. no cap, you understood the assignment. periodt β¨
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms