1= nng_push(7)
2//
3// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
4// Copyright 2018 Capitar IT Group BV <info@capitar.com>
5//
6// This document is supplied under the terms of the MIT License, a
7// copy of which should be located in the distribution where this
8// file was obtained (LICENSE.txt).  A copy of the license may also be
9// found online at https://opensource.org/licenses/MIT.
10//
11
12== NAME
13
14nng_push - push protocol
15
16== SYNOPSIS
17
18[source,c]
19----
20#include <nng/protocol/pipeline0/push.h>
21----
22
23== DESCRIPTION
24
25(((protocol, _push_)))
26The ((_push_ protocol)) is one half of a ((pipeline pattern)).
27The other side is the xref:nng_pull.7.adoc[_pull_] protocol.
28
29In the pipeline pattern, pushers distribute messages to pullers.
30Each message sent by a pusher will be sent to one of its peer pullers,
31chosen in a round-robin fashion
32from the set of connected peers available for receiving.
33This property makes this pattern useful in ((load-balancing)) scenarios.
34
35=== Socket Operations
36
37The xref:nng_push_open.3.adoc[`nng_push0_open()`] call creates a pusher socket.
38This socket may be used to send messages, but is unable to receive them.
39Attempts to receive messages will result in `NNG_ENOTSUP`.
40
41Send operations will observe flow control (back-pressure), so that
42only peers capable of accepting a message will be considered.
43If no peer is available to receive a message, then the send operation will
44wait until one is available, or the operation times out.
45
46NOTE: Although the pipeline protocol honors flow control, and attempts
47to avoid dropping messages, no guarantee of delivery is made.
48Furthermore, as there is no capability for message acknowledgment,
49applications that need reliable delivery are encouraged to consider the
50xref:nng_req.7.adoc[_req_] protocol instead.
51
52=== Protocol Versions
53
54Only version 0 of this protocol is supported.
55(At the time of writing, no other versions of this protocol have been defined.)
56
57=== Protocol Options
58
59xref:nng_options.5.adoc#NNG_OPT_SENDBUF[`NNG_OPT_SENDBUF`]::
60
61    (`int`, 0 - 8192)
62    Normally this is set to zero, indicating that send operations are unbuffered.
63    In unbuffered operation, send operations will wait until a suitable peer is available to receive the message.
64    If this is set to a positive value (up to 8192), then an intermediate buffer is
65    provided for the socket with the specified depth (in messages).
66
67NOTE: Transport layer buffering may occur in addition to any socket
68    buffer determined by this option.
69
70=== Protocol Headers
71
72The _push_ protocol has no protocol-specific headers.
73
74== SEE ALSO
75
76[.text-left]
77xref:nng_push_open.3.adoc[nng_push(3)],
78xref:nng_pull.7.adoc[nng_pull(7)],
79xref:nng_req.7.adoc[nng_req(7)],
80xref:nng.7.adoc[nng(7)]
81