Realm C++ SDK Version v2.2.0
|
#include <websocket.hpp>
Public Member Functions | |
virtual void | websocket_connected_handler (const std::string &protocol)=0 |
virtual void | websocket_error_handler ()=0 |
virtual bool | websocket_binary_message_received (std::string_view data)=0 |
virtual bool | websocket_closed_handler (bool was_clean, websocket_err_codes error_code, std::string_view message)=0 |
WebSocket observer interface in the Sync Client that receives the websocket events during operation.
|
pure virtual |
Called whenever a full message has arrived. The WebSocket implementation is responsible for defragmenting fragmented messages internally and delivering a full message to the Sync Client.
data | A util::Span containing the data received from the server. The buffer is only valid until the function returns. |
|
pure virtual |
Called whenever the WebSocket connection has been closed, either as a result of a WebSocket error or a normal close.
was_clean | Was the TCP connection closed after the WebSocket closing handshake was completed. |
error_code | The error code received or synthesized when the websocket was closed. |
message | The message received in the close frame when the websocket was closed. |
|
pure virtual |
Called when the WebSocket is connected, i.e. after the handshake is done. The Sync Client is not allowed to send messages on the socket before the handshake is complete and no message_received callbacks will be called before the handshake is done.
protocol | The negotiated subprotocol value returned by the server |
|
pure virtual |
Called when an error occurs while establishing the WebSocket connection to the server or during normal operations. No additional binary messages will be processed after this function is called.