Skip to content

Editor → Protocol → loopback_transport.h

loopback_client

Syntax

class CONJURE_API loopback_client

Constructors

AccessSignatureDescription
privateexplicit loopback_client( std::shared_ptr<state> shared) noexcept;
publicloopback_client();
publicloopback_client( const loopback_client &) = default;

Destructors

AccessSignatureDescription
public~loopback_client();

Variables

AccessNameTypeDefaultDescription
privatemStatestd::shared_ptr<state>nullptr

Functions

Public

client_id

[[nodiscard]] u32 client_id() const;

The id the server assigned (0 until the server's first poll() accepted the client).

disconnect

void disconnect();

Closes the client side; the server sees the disconnect at its next poll().

is_connected

[[nodiscard]] bool is_connected() const;

pending

[[nodiscard]] usize pending() const;

Lines waiting to be received.

receive

[[nodiscard]] std::optional<std::string> receive();

The next line the server sent, without its newline; nullopt when none is waiting.

receive_all

[[nodiscard]] std::vector<std::string> receive_all();

Every waiting line.

send

void send(
    std::string_view line);

Queues one line (a newline is appended when missing) for the server's next poll().

send_raw

void send_raw(
    std::string_view bytes);

Queues raw bytes without framing (partial lines, several lines in one chunk).

Operator Overloads

Public

operator=

loopback_client &operator=(
    const loopback_client &) = default;