![]() |
BeeeOn Gateway
v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
|
Implements the communication via WebSockets with the remote server. Outgoing messages are prioritized based on the configured GWSPriorityAssigner instance. Incoming messages are broadcasted via the registered GWSListener instances. The GWSConnectorImpl takes care just for the lowest-level communication details: More...
#include <GWSConnectorImpl.h>
Public Member Functions | |
void | setHost (const std::string &host) |
void | setPort (int port) |
void | setMaxMessageSize (int size) |
void | setSSLConfig (SSLClient::Ptr config) |
void | setReceiveTimeout (const Poco::Timespan &timeout) |
void | setSendTimeout (const Poco::Timespan &timeout) |
void | setReconnectDelay (const Poco::Timespan &delay) |
void | setKeepAliveTimeout (const Poco::Timespan &timeout) |
void | setMaxFailedReceives (int count) |
void | setGatewayInfo (GatewayInfo::Ptr info) |
void | run () |
void | stop () |
![]() | |
void | setOutputsCount (int count) |
void | setPriorityAssigner (GWSPriorityAssigner::Ptr assigner) |
void | setupQueues () |
Setup queues based on configuration. This must be called before the connector is started. | |
void | send (const GWMessage::Ptr message) override |
Put the message into a queue and notify sender to check queues for updates. | |
![]() | |
void | addListener (GWSListener::Ptr listener) |
Register a GWSListener instance that would receive events related to the communication. | |
void | clearListeners () |
Remove all registered listeners. | |
void | setEventsExecutor (AsyncExecutor::Ptr executor) |
Configure an AsyncExecutor instance that would be used for GWSListener events delivery. | |
Protected Member Functions | |
void | waitBeforeReconnect () |
Poco::SharedPtr < Poco::Net::WebSocket > | connect (const std::string &host, int port) const |
void | performRegister (Poco::Net::WebSocket &socket) const |
bool | performOutput (Poco::Net::WebSocket &socket) |
void | performPing (Poco::Net::WebSocket &socket) |
void | checkPingTimeout () const |
void | outputLoop (StopControl::Run &run, Poco::Net::WebSocket &socket) |
bool | waitOutputs () |
Wait while the output queues are empty. The waiting delay is driver by the keepAliveTimeout. More... | |
const Poco::Timespan | keepAliveRemaining () const |
void | onReadable (const Poco::AutoPtr< Poco::Net::ReadableNotification > &n) |
void | sendMessage (Poco::Net::WebSocket &socket, const GWMessage &message) const |
void | sendFrame (Poco::Net::WebSocket &socket, const std::string &payload, const int flags) const |
GWMessage::Ptr | receiveMessage (Poco::Net::WebSocket &socket) const |
int | receiveFrame (Poco::Net::WebSocket &socket, Poco::Buffer< char > &buffer, int &flags) const |
![]() | |
size_t | selectOutput () const |
void | updateOutputs (size_t i) |
bool | outputValid (size_t i) const |
GWMessage::Ptr | peekOutput (size_t i) const |
void | popOutput (size_t i) |
Pop the first (oldest) message in the queue of the given index. | |
![]() | |
template<typename Event , typename Method > | |
void | fireEvent (const Event &e, const Method &m) |
void | fireReceived (const GWMessage::Ptr message) |
![]() | |
void | setupLogger (Poco::Logger *logger=0) const |
Poco::Logger & | logger () const |
Loggable (const ClassInfo &info) | |
Loggable (const std::type_info &info) | |
Additional Inherited Members | |
![]() | |
typedef Poco::SharedPtr < GWSConnector > | Ptr |
![]() | |
typedef Poco::SharedPtr < StoppableRunnable > | Ptr |
![]() | |
static Poco::Logger & | forMethod (const char *name) |
static Poco::Logger & | forClass (const ClassInfo &info) |
static Poco::Logger & | forClass (const std::type_info &info) |
template<typename T > | |
static Poco::Logger & | forInstance (const T *i) |
static void | configureSimple (Poco::Logger &logger, const std::string &level) |
static void | logException (Poco::Logger &logger, const Poco::Message::Priority priority, const Poco::Exception &e, const char *file, size_t line) |
![]() | |
Poco::Event | m_outputsUpdated |
Poco::Mutex | m_outputLock |
Implements the communication via WebSockets with the remote server. Outgoing messages are prioritized based on the configured GWSPriorityAssigner instance. Incoming messages are broadcasted via the registered GWSListener instances. The GWSConnectorImpl takes care just for the lowest-level communication details:
|
protected |
|
virtual |
Stop the runnable. The call should not block.
Implements BeeeOn::StoppableRunnable.
|
protected |
Wait while the output queues are empty. The waiting delay is driver by the keepAliveTimeout.