Realm C++ SDK Version v2.2.0
|
Built in websocket provider. More...
#include <websocket.hpp>
Classes | |
struct | configuration |
Public Member Functions | |
default_socket_provider (const configuration &c) | |
std::unique_ptr< websocket_interface > | connect (std::unique_ptr< websocket_observer >, websocket_endpoint &&) override |
void | post (FunctionHandler &&) override |
sync_timer | create_timer (std::chrono::milliseconds delay, FunctionHandler &&) override |
Public Member Functions inherited from realm::networking::sync_socket_provider | |
virtual | ~sync_socket_provider ()=default |
virtual std::unique_ptr< websocket_interface > | connect (std::unique_ptr< websocket_observer > observer, websocket_endpoint &&endpoint)=0 |
virtual void | post (FunctionHandler &&handler)=0 |
virtual sync_timer | create_timer (std::chrono::milliseconds delay, FunctionHandler &&handler)=0 |
Protected Attributes | |
configuration | m_configuration |
Additional Inherited Members | |
Public Types inherited from realm::networking::sync_socket_provider | |
using | FunctionHandler = std::function< void(status)> |
Function handler typedef. | |
using | sync_timer = std::unique_ptr< sync_socket_provider::timer > |
Other class typedefs. | |
Built in websocket provider.
|
overridevirtual |
Create a new websocket pointed to the server indicated by endpoint and connect to the server. Any events that occur during the execution of the websocket will call directly to the handlers provided by the observer. The web_socket_observer guarantees that the WebSocket object will be closed/destroyed before the observer is terminated/destroyed.
Implements realm::networking::sync_socket_provider.
|
overridevirtual |
Create and register a new timer whose handler function will be posted to the event loop when the provided delay expires.
This is a one shot timer and the Timer class returned becomes invalid once the timer has expired. A new timer will need to be created to wait again.
delay | The duration to wait in ms before the timer expires. |
handler | The handler function to be called on the event loop when the timer expires. |
Implements realm::networking::sync_socket_provider.
|
overridevirtual |
Submit a handler function to be executed by the event loop (thread).
Register the specified handler function to be queued on the event loop for immediate asynchronous execution. The specified handler will be executed by an expression on the form handler()
. If the the handler object is movable, it will never be copied. Otherwise, it will be copied as necessary.
This function is thread-safe and can be called by any thread. It can also be called from other post() handler function.
The handler will never be called as part of the execution of post(). If post() is called on a thread separate from the event loop, the handler may be called before post() returns.
Handler functions added through post() must be executed in the order they are added. More precisely, if post() is called twice to add two handlers, A and B, and the execution of post(A) ends before the beginning of the execution of post(B), then A is guaranteed to execute before B.
handler | The handler function to be queued on the event loop. |
Implements realm::networking::sync_socket_provider.