#include <websocket_channel.hpp>
|
| static std::unique_ptr< WebSocketChannel > | connect (std::unique_ptr< TcpStream > tcp, std::string_view host, std::string_view path="/", WebSocketOptions options={}) |
| | Perform a client handshake over tcp, then start the reader.
|
| static std::unique_ptr< WebSocketChannel > | accept (std::unique_ptr< TcpStream > tcp, WebSocketOptions options={}) |
| | Perform a server-side handshake over an already-accepted tcp connection.
|
| static std::string | compute_accept_key (std::string_view client_key) |
| | Expose the handshake Sec-WebSocket-Accept for debugging and for tests that want to verify RFC 6455 compliance.
|
◆ ~WebSocketChannel()
| pulp::runtime::WebSocketChannel::~WebSocketChannel |
( |
| ) |
|
|
override |
◆ accept()
| std::unique_ptr< WebSocketChannel > pulp::runtime::WebSocketChannel::accept |
( |
std::unique_ptr< TcpStream > | tcp, |
|
|
WebSocketOptions | options = {} ) |
|
static |
Perform a server-side handshake over an already-accepted tcp connection.
Reads the HTTP upgrade request, validates the key, writes a 101 Switching Protocols response, and starts the reader. Returns nullptr on failure.
◆ close()
| void pulp::runtime::WebSocketChannel::close |
( |
| ) |
|
|
overridevirtual |
◆ compute_accept_key()
| std::string pulp::runtime::WebSocketChannel::compute_accept_key |
( |
std::string_view | client_key | ) |
|
|
static |
Expose the handshake Sec-WebSocket-Accept for debugging and for tests that want to verify RFC 6455 compliance.
◆ connect()
| std::unique_ptr< WebSocketChannel > pulp::runtime::WebSocketChannel::connect |
( |
std::unique_ptr< TcpStream > | tcp, |
|
|
std::string_view | host, |
|
|
std::string_view | path = "/", |
|
|
WebSocketOptions | options = {} ) |
|
static |
Perform a client handshake over tcp, then start the reader.
host and path populate the HTTP/1.1 upgrade request (Host: header + request-URI). Returns nullptr on failure.
◆ is_open()
| bool pulp::runtime::WebSocketChannel::is_open |
( |
| ) |
const |
|
overridevirtual |
◆ on_closed()
◆ on_error()
◆ on_message()
| void pulp::runtime::WebSocketChannel::on_message |
( |
MessageCallback | callback | ) |
|
|
overridevirtual |
Install / replace callbacks.
Safe to call at any time; callbacks installed during send-processing apply to subsequent messages.
Implements pulp::runtime::MessageChannel.
◆ send() [1/2]
| bool pulp::runtime::MessageChannel::send |
( |
std::string_view | text | ) |
|
|
inlineinherited |
◆ send() [2/2]
| bool pulp::runtime::WebSocketChannel::send |
( |
const std::uint8_t * | data, |
|
|
std::size_t | size ) |
|
overridevirtual |
Send a message.
Returns true if the payload was accepted for transmission (queued or written); false if the channel is closed, errored, or the payload was rejected (e.g., frame too large).
The default overload sends binary; override send_text if the transport distinguishes text from binary.
Implements pulp::runtime::MessageChannel.
◆ send_text()
| bool pulp::runtime::WebSocketChannel::send_text |
( |
std::string_view | text | ) |
|
|
overridevirtual |
The documentation for this class was generated from the following file: