Realm C++ SDK Version v2.2.0
|
#include <websocket.hpp>
Public Types | |
using | FunctionHandler = std::function< void(status)> |
Public Member Functions | |
virtual | ~websocket_interface ()=default |
virtual void | async_write_binary (std::string_view data, FunctionHandler &&handler)=0 |
The WebSocket base class that is used by the SyncClient to send data over the WebSocket connection with the server. This is the class that is returned by sync_socket_provider::connect() when a connection to an endpoint is requested. If an error occurs while establishing the connection, the error is presented to the web_socket_observer provided when the WebSocket was created.
|
virtualdefault |
The destructor must close the websocket connection when the WebSocket object is destroyed
|
pure virtual |
Write data asynchronously to the WebSocket connection. The handler function will be called when the data has been sent successfully. The web_socket_oberver provided when the WebSocket was created will be called if any errors occur during the write operation.
data | A std::string_view containing the data to be sent to the server. |
handler | The handler function to be called when the data has been sent successfully or the websocket has been closed (with ErrorCodes::OperationAborted). If an error occurs during the write operation, the websocket will be closed and the error will be provided via the websocket_closed_handler() function. |
Implemented in realm::networking::default_socket.