1= nng_pub(7)
2//
3// Copyright 2018 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_pub - publisher protocol
15
16== SYNOPSIS
17
18[source,c]
19----
20#include <nng/protocol/pubsub0/pub.h>
21----
22
23== DESCRIPTION
24
25(((protocol, _pub_)))
26The ((_pub_ protocol)) is one half of a ((publisher))/subscriber pattern.
27In this pattern, a publisher sends data, which is broadcast to all
28subscribers.
29The subscribing applications only see the data to which
30they have subscribed.
31
32The _pub_ protocol is the publisher side, and the
33xref:nng_sub.7.adoc[_sub_] protocol is the subscriber side.
34
35NOTE: In this implementation, the publisher delivers all messages to all
36subscribers.
37The subscribers maintain their own subscriptions, and filter them locally.
38Thus, this pattern should not be used in an attempt to reduce bandwidth
39consumption.
40
41The topics that subscribers subscribe to is just the first part of
42the message body.
43Applications should construct their messages accordingly.
44
45=== Socket Operations
46
47The xref:nng_pub_open.3.adoc[`nng_pub0_open()`] functions create a publisher socket.
48This socket may be used to send messages, but is unable to receive them.
49Attempts to receive messages will result in `NNG_ENOTSUP`.
50
51=== Protocol Versions
52
53Only version 0 of this protocol is supported.
54(At the time of writing, no other versions of this protocol have been defined.)
55
56=== Protocol Options
57
58The _pub_ protocol has no protocol-specific options.
59
60=== Protocol Headers
61
62The _pub_ protocol has no protocol-specific headers.
63
64== SEE ALSO
65
66[.text-left]
67xref:nng_pub_open.3.adoc[nng_pub_open(3)],
68xref:nng_sub.7.adoc[nng_sub(7)],
69xref:nng.7.adoc[nng(7)]
70