Turi Create  4.0
turi::nanosockets::publish_socket Class Reference

#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 ()
 

Detailed Description

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.

publish_socket pubsock("ipc:///tmp/publish");
pubsock.send("hello world")

Definition at line 37 of file publish_socket.hpp.

Constructor & Destructor Documentation

◆ publish_socket()

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

Parameters
bind_addressthis will be address to bind to.

Member Function Documentation

◆ close()

void turi::nanosockets::publish_socket::close ( )

Closes this socket. Once closed, the socket cannot be used again.

◆ get_bound_address()

std::string turi::nanosockets::publish_socket::get_bound_address ( )

Returns the address the socket is bound to

◆ send()

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.


The documentation for this class was generated from the following file: