Turi Create
4.0
|
#include <core/system/nanosockets/publish_socket.hpp>
Public Member Functions | |
publish_socket (std::string bind_address) | |
void | close () |
void | send (const std::string &message) |
std::string | get_bound_address () |
Constructs a Nanomsg publish socket.
The publish socket is bound to a zeromq style endpoint address Endpoints are standard Zeromq style endpoint addresses , for instance, tcp://[ip]:[port], or ipc://[filename] (interprocess socket) or inproc://[handlename] (inprocess socket).
Subscribe sockets (subscribe_socket) can then attach to the endpoint and listen for published messages. Note that publish-subscribe is not necessarily reliable; i.e. subscribers may not receive all published data.
Definition at line 37 of file publish_socket.hpp.
turi::nanosockets::publish_socket::publish_socket | ( | std::string | bind_address | ) |
Constructs a publish socket. The request will be sent to the current owners of the key
bind_address | this will be address to bind to. |
void turi::nanosockets::publish_socket::close | ( | ) |
Closes this socket. Once closed, the socket cannot be used again.
std::string turi::nanosockets::publish_socket::get_bound_address | ( | ) |
Returns the address the socket is bound to
void turi::nanosockets::publish_socket::send | ( | const std::string & | message | ) |
Sends a message. All subscribers which match the message (by prefix) will receive a copy. This function is not safe to call in parallel.