oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::ws::Connection Class Reference

Non-owning handle to an active WebSocket connection. More...

#include <net_httpd.hpp>

Public Member Functions

 Connection (ove_httpd_ws_conn_t *raw)
 Wraps an opaque ove_httpd_ws_conn_t * from the handler callback.
 
Result< void > send (const void *data, size_t len) noexcept
 Send a text message to this connection.
 
Result< void > send (std::string_view sv) noexcept
 Send a string_view as a text message.
 
ove_httpd_ws_conn_t * raw () const
 Returns the underlying ove_httpd_ws_conn_t * (for C-API escape hatches).
 

Detailed Description

Non-owning handle to an active WebSocket connection.

Valid only while the connection is active. Wraps the opaque ove_httpd_ws_conn_t pointer.

Member Function Documentation

◆ send() [1/2]

Result< void > ove::ws::Connection::send ( const void *  data,
size_t  len 
)
inlinenoexcept

Send a text message to this connection.

Parameters
[in]dataMessage payload.
[in]lenPayload length in bytes.
Returns
Empty Result<void> on success; unexpected Error on failure.

◆ send() [2/2]

Result< void > ove::ws::Connection::send ( std::string_view  sv)
inlinenoexcept

Send a string_view as a text message.

Parameters
[in]svString view to send.
Returns
As send(const void*, size_t).

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