Radix Relay
Hybrid mesh communications with Signal Protocol encryption
Loading...
Searching...
No Matches
websocket_stream.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <boost/asio.hpp>
4#include <boost/system/error_code.hpp>
5#include <concepts>
6#include <cstddef>
7#include <functional>
8#include <span>
9
13
14namespace radix_relay::concepts {
15
22template<typename T>
23concept websocket_stream = requires(T &stream,
24 const transport::websocket_connection_params params,
25 const std::span<const std::byte> data,
26 const boost::asio::mutable_buffer &buffer,
27 std::function<void(const boost::system::error_code &, std::size_t)> handler) {
28 { stream.async_connect(params, handler) } -> std::same_as<void>;
29 { stream.async_write(data, handler) } -> std::same_as<void>;
30 { stream.async_read(buffer, handler) } -> std::same_as<void>;
31 { stream.async_close(handler) } -> std::same_as<void>;
32};
33
34}// namespace radix_relay::concepts
Concept defining the interface for WebSocket stream operations.
Parameters for establishing a WebSocket connection.