Realm C++ SDK Version v2.2.0
Public Types | Public Member Functions | List of all members
realm::networking::websocket_interface Struct Referenceabstract

#include <websocket.hpp>

Inheritance diagram for realm::networking::websocket_interface:
realm::networking::default_socket

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~websocket_interface()

virtual realm::networking::websocket_interface::~websocket_interface ( )
virtualdefault

The destructor must close the websocket connection when the WebSocket object is destroyed

Member Function Documentation

◆ async_write_binary()

virtual void realm::networking::websocket_interface::async_write_binary ( std::string_view  data,
FunctionHandler &&  handler 
)
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.

Parameters
dataA std::string_view containing the data to be sent to the server.
handlerThe 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.


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