|
| | WsClient (Reactor &reactor, Stream &&stream, Handler &handler, const WsClientConfig &cfg={}) |
| |
| | ~WsClient () override |
| |
| | WsClient (const WsClient &)=delete |
| |
| WsClient & | operator= (const WsClient &)=delete |
| |
| bool | start (std::string_view host, std::uint16_t port, bool tls, std::string_view target, std::string_view extra_headers={}) |
| | Registers with the reactor and begins the connect/TLS/upgrade sequence.
|
| |
| bool | send_text (std::string_view text) noexcept |
| | False means the frame did not go out: the client is not open, the frame did not fit, or the write failed and closed the stream (on_ws_error already fired).
|
| |
| bool | send_binary (std::span< const std::byte > data) noexcept |
| |
| bool | send_ping (std::span< const std::byte > data={}) noexcept |
| |
| bool | send_pong (std::span< const std::byte > data={}) noexcept |
| |
| void | cork () noexcept |
| | Between cork() and uncork() data frames are only encoded into the send buffer; uncork() writes them together (one TLS write and one write(2) for the lot when the kernel takes it).
|
| |
| bool | uncork () noexcept |
| |
| bool | send_close (WsCloseCode code=WsCloseCode::Normal, std::string_view reason={}) noexcept |
| | Starts the closing handshake; on_ws_close fires when the peer echoes the close frame.
|
| |
| void | close () noexcept |
| | Immediate teardown, no callbacks.
|
| |
| WsState | state () const noexcept |
| |
| bool | is_open () const noexcept |
| |
| const WsStats & | stats () const noexcept |
| |
| std::size_t | pending_send_bytes () const noexcept |
| |
| Stream & | stream () noexcept |
| |
| int | fd () const noexcept |
| |
| void | on_readable () override |
| |
| void | on_writable () override |
| |
| void | on_error (int err) override |
| | POLLERR (or a poll request the kernel refused).
|
| |
| void | on_message (WsOpcode op, std::span< std::byte > payload) noexcept |
| |
| void | on_control (WsOpcode op, std::span< std::byte > payload) noexcept |
| |
Public Member Functions inherited from fastmm::net::IoHandler |
| virtual | ~IoHandler ()=default |
| |
template<ByteStream Stream, WsClientHandler Handler>
False means the frame did not go out: the client is not open, the frame did not fit, or the write failed and closed the stream (on_ws_error already fired).
A frame the kernel did not take yet is queued for writability and counts as sent. Between cork() and uncork() a data frame is only encoded, so uncork() reports its write instead.