CppServer  1.0.0.0
C++ Server Library
Public Member Functions | List of all members
CppServer::Nanomsg::SubscribeClient Class Reference

Nanomsg subscribe client. More...

#include <subscribe_client.h>

Inheritance diagram for CppServer::Nanomsg::SubscribeClient:
CppServer::Nanomsg::Client

Public Member Functions

 SubscribeClient (const std::string &address, const std::string &topic="", bool threading=true)
 Initialize client with a given endpoint address. More...
 
 SubscribeClient (const SubscribeClient &)=delete
 
 SubscribeClient (SubscribeClient &&)=default
 
virtual ~SubscribeClient ()=default
 
SubscribeClientoperator= (const SubscribeClient &)=delete
 
SubscribeClientoperator= (SubscribeClient &&)=default
 
- Public Member Functions inherited from CppServer::Nanomsg::Client
 Client (Domain domain, Protocol protocol, const std::string &address, bool threading=true)
 Initialize client with a given domain, protocol and endpoint address. More...
 
 Client (const Client &)=delete
 
 Client (Client &&)=default
 
virtual ~Client ()
 
Clientoperator= (const Client &)=delete
 
Clientoperator= (Client &&)=default
 
Socketsocket () noexcept
 Get the Nanomsg socket. More...
 
bool IsConnected () const noexcept
 Is the client connected? More...
 
bool Connect ()
 Connect the client. More...
 
bool Disconnect ()
 Disconnect the client. More...
 
bool Reconnect ()
 Reconnect the client. More...
 
size_t Send (const void *buffer, size_t size)
 Send data to the server. More...
 
size_t Send (const std::string &text)
 Send a text string to the server. More...
 
size_t Send (const Message &message)
 Send a message to the server. More...
 
size_t TrySend (const void *buffer, size_t size)
 Try to send data to the server in non-blocking mode. More...
 
size_t TrySend (const std::string &text)
 Try to send a text string to the server in non-blocking mode. More...
 
size_t TrySend (const Message &message)
 Try to send a message to the server in non-blocking mode. More...
 
size_t Receive (Message &message)
 Receive a message from the server. More...
 
size_t TryReceive (Message &message)
 Try to receive a message from the server in non-blocking mode. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CppServer::Nanomsg::Client
virtual void onThreadInitialize ()
 Initialize thread handler. More...
 
virtual void onThreadCleanup ()
 Cleanup thread handler. More...
 
virtual void onConnected ()
 Handle client connected notification. More...
 
virtual void onDisconnected ()
 Handle client disconnected notification. More...
 
virtual void onIdle ()
 Handle client idle notification. More...
 
virtual void onReceived (Message &message)
 Handle message received notification. More...
 
virtual void onError (int error, const std::string &message)
 Handle error notification. More...
 

Detailed Description

Nanomsg subscribe client.

Nanomsg subscribe client is used to receive published messages from the Nanomsg subscribe server.

Receives messages from the publisher. Only messages that the socket is subscribed to are received. When the socket is created there are no subscriptions and thus no messages will be received. Send operation is not defined on this socket.

Thread-safe.

Examples:
nanomsg_subscribe_client.cpp.

Definition at line 29 of file subscribe_client.h.

Constructor & Destructor Documentation

◆ SubscribeClient() [1/3]

CppServer::Nanomsg::SubscribeClient::SubscribeClient ( const std::string &  address,
const std::string &  topic = "",
bool  threading = true 
)
inlineexplicit

Initialize client with a given endpoint address.

Parameters
address- Endpoint address
topic- Subscription topic (default is "")
threading- Run the client in a separate thread (default is true)
Examples:
nanomsg_subscribe_client.cpp.

Definition at line 38 of file subscribe_client.h.

◆ SubscribeClient() [2/3]

CppServer::Nanomsg::SubscribeClient::SubscribeClient ( const SubscribeClient )
delete

◆ SubscribeClient() [3/3]

CppServer::Nanomsg::SubscribeClient::SubscribeClient ( SubscribeClient &&  )
default

◆ ~SubscribeClient()

virtual CppServer::Nanomsg::SubscribeClient::~SubscribeClient ( )
virtualdefault

Member Function Documentation

◆ operator=() [1/2]

SubscribeClient& CppServer::Nanomsg::SubscribeClient::operator= ( const SubscribeClient )
delete

◆ operator=() [2/2]

SubscribeClient& CppServer::Nanomsg::SubscribeClient::operator= ( SubscribeClient &&  )
default

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