Radix Relay
Hybrid mesh communications with Signal Protocol encryption
Loading...
Searching...
No Matches
radix_relay::transport::websocket_stream Class Reference

WebSocket stream with TLS support. More...

#include <websocket_stream.hpp>

Public Member Functions

 websocket_stream (const std::shared_ptr< boost::asio::io_context > &io_context)
 Constructs a WebSocket stream.
 
auto async_connect (websocket_connection_params params, std::function< void(const boost::system::error_code &, std::size_t)> handler) -> void
 Asynchronously connects to a WebSocket endpoint.
 
auto async_write (std::span< const std::byte > data, std::function< void(const boost::system::error_code &, std::size_t)> handler) -> void
 Asynchronously writes data to the WebSocket.
 
auto async_read (const boost::asio::mutable_buffer &buffer, std::function< void(const boost::system::error_code &, std::size_t)> handler) -> void
 Asynchronously reads data from the WebSocket.
 
auto async_close (std::function< void(const boost::system::error_code &, std::size_t)> handler) -> void
 Asynchronously closes the WebSocket connection.
 

Detailed Description

WebSocket stream with TLS support.

Provides asynchronous operations for secure WebSocket connections using Boost.Beast.

Definition at line 32 of file websocket_stream.hpp.

Constructor & Destructor Documentation

◆ websocket_stream()

radix_relay::transport::websocket_stream::websocket_stream ( const std::shared_ptr< boost::asio::io_context > &  io_context)
explicit

Constructs a WebSocket stream.

Parameters
io_contextBoost.Asio io_context for async operations

Member Function Documentation

◆ async_close()

auto radix_relay::transport::websocket_stream::async_close ( std::function< void(const boost::system::error_code &, std::size_t)>  handler) -> void

Asynchronously closes the WebSocket connection.

Parameters
handlerCompletion handler called with error code and bytes transferred

◆ async_connect()

auto radix_relay::transport::websocket_stream::async_connect ( websocket_connection_params  params,
std::function< void(const boost::system::error_code &, std::size_t)>  handler 
) -> void

Asynchronously connects to a WebSocket endpoint.

Parameters
paramsConnection parameters (host, port, path)
handlerCompletion handler called with error code and bytes transferred

◆ async_read()

auto radix_relay::transport::websocket_stream::async_read ( const boost::asio::mutable_buffer &  buffer,
std::function< void(const boost::system::error_code &, std::size_t)>  handler 
) -> void

Asynchronously reads data from the WebSocket.

Parameters
bufferBuffer to store received data
handlerCompletion handler called with error code and bytes transferred

◆ async_write()

auto radix_relay::transport::websocket_stream::async_write ( std::span< const std::byte >  data,
std::function< void(const boost::system::error_code &, std::size_t)>  handler 
) -> void

Asynchronously writes data to the WebSocket.

Parameters
dataData bytes to write
handlerCompletion handler called with error code and bytes transferred

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