NNG_HTTP_SERVER_ADD_HANDLER(3http)
π
nng_http_server_add_handler β the 3http page from the NNG Reference Manual, bestie edition π
okay so picture this: you're deep in the NNG Reference Manual, section 3http, and you need to glue a handler onto a server. That's it. That's the whole vibe. Let's go β¨
πΈ NAME πΈ
nng_http_server_add_handler β add an HTTP server handler, no cap π«Ά
β¨ SYNOPSIS β¨
#include <nng/nng.h>
#include <nng/supplemental/http/http.h>
int nng_http_server_add_handler(nng_http_server *s, nng_http_handler *h);
π DESCRIPTION π
So nng_http_server_add_handler() literally just adds the handler h to the server instance s. Match made in heaven, honestly π
But listen β if another handler is already added to the server that would conflict with handler h, then the operation will fail with NNG_EADDRINUSE. Like, the spot's taken, bestie, pick a different one π
Also important: if a handler is added to a server, and the server is subsequently deallocated, the handler and any of its resources will also be deallocated. They go down together. Ride or die. π«Ά
And if you ever change your mind, handlers that are added to a server may be subsequently removed using the nng_http_server_del_handler() function. Cleanup queen behaviour π
π RETURN VALUES π
This function returns 0 on success, and non-zero otherwise. Simple as that β¨
π ERRORS π
NNG_EADDRINUSEβ Handler conflicts with another handler. (the drama π€)NNG_ENOMEMβ Insufficient free memory exists. (your RAM said no πͺ«)NNG_ENOTSUPβ HTTP not supported. (it's giving "wrong build" π)
π¦ SEE ALSO π¦
nng_http_handler_alloc(3http)nng_http_server_del_handler(3http)nng_http_server_hold(3http)nng_strerror(3)nng(7)
and that's the whole page, bestie β go forth and register those handlers π
mwah π β this was the NNG Reference Manual, NNG_HTTP_...DD_HANDLER(3http), dated 2026-01-13. now go touch some grass (after you check your return values) π±β¨
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms