A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::net::WebSocketWireStream Class Referencefinal

A WireStream that carries A11 traffic over a client or accepted WebSocket. More...

#include <cpp/a11/net/websocket_wire_stream.h>

Inheritance diagram for a11::net::WebSocketWireStream:
[legend]

Public Member Functions

const std::string & GetRequestPath () const
 The path this stream was accepted on, query string included.
 
const HttpHeaders & GetRequestHeaders () const
 The headers the accepted request carried.
 
 WebSocketWireStream (ConstructorToken, std::shared_ptr< State > state)
 
- Public Member Functions inherited from a11::net::ChannelWireStream
 ~ChannelWireStream () override
 
absl::Status Send (data::WireMessage message) override
 Enqueue a message for delivery to the peer.
 
a11::Task Start (OnMessage on_message, OnDone on_done) override
 Begin the stream as the initiating ("start") side.
 
a11::Task Accept (OnMessage on_message, OnDone on_done) override
 Begin the stream as the accepting ("accept") side.
 
absl::Status HalfClose (data::ByteMap trailers) override
 Signal that this side will send no more messages.
 
a11::Task DrainOutgoingMessages () override
 Await delivery of all buffered outbound messages.
 
absl::Status Abort (absl::Status status) override
 Abort the stream, discarding buffered work.
 
absl::Status SetDeadline (absl::Time deadline) override
 Set the absolute deadline after which the stream is aborted.
 
absl::Time deadline () const override
 
absl::Status GetStatus () const override
 
std::optional< data::ByteMap > GetTrailers () const override
 
std::string GetId () const override
 
void *absl_nullable GetImpl () const override
 
absl::Status HalfClose ()
 Half-close with no trailers.
 
virtual absl::Status HalfClose (data::ByteMap trailers)=0
 Signal that this side will send no more messages.
 
absl::Status SetDeadline ()
 Clear any deadline (equivalent to an infinite deadline).
 
virtual absl::Status SetDeadline (absl::Time deadline)=0
 Set the absolute deadline after which the stream is aborted.
 
- Public Member Functions inherited from a11::net::WireStream
virtual ~WireStream ()=default
 
absl::Status HalfClose ()
 Half-close with no trailers.
 
absl::Status SetDeadline ()
 Clear any deadline (equivalent to an infinite deadline).
 

Static Public Member Functions

static absl::StatusOr< std::shared_ptr< WebSocketWireStream > > CreateClient (const std::string &url, WireStreamOptions options={}, WebSocketClientOptions websocket_options={})
 Dials a WebSocket endpoint and returns a WireStream over it.
 

Friends

class WebSocketWireServer
 

Additional Inherited Members

- Public Types inherited from a11::net::ChannelWireStream
using OpenOperation = std::function< absl::Status()>
 Transport-specific operation that initiates or accepts the channel.
 
- Protected Member Functions inherited from a11::net::ChannelWireStream
 ChannelWireStream (std::shared_ptr< State > state)
 
- Static Protected Member Functions inherited from a11::net::ChannelWireStream
static absl::StatusOr< std::shared_ptr< State > > MakeState (std::shared_ptr< internal::BinaryChannel > channel, std::string id, ChannelEndpointRole role, OpenOperation open_operation, WireStreamOptions options, ChannelFramingOptions framing={})
 

Detailed Description

A WireStream that carries A11 traffic over a client or accepted WebSocket.

Client instances are created with CreateClient(); server-accepted instances are produced by WebSocketWireServer. Framing and message delivery are handled by the ChannelWireStream base.

Constructor & Destructor Documentation

◆ WebSocketWireStream()

a11::net::WebSocketWireStream::WebSocketWireStream ( ConstructorToken  ,
std::shared_ptr< State >  state 
)
inlineexplicit

Member Function Documentation

◆ CreateClient()

absl::StatusOr< std::shared_ptr< WebSocketWireStream > > a11::net::WebSocketWireStream::CreateClient ( const std::string &  url,
WireStreamOptions  options = {},
WebSocketClientOptions  websocket_options = {} 
)
static

Dials a WebSocket endpoint and returns a WireStream over it.

Parameters
urlThe ws:// or wss:// URL of the remote A11 endpoint.
optionsTransport-level WireStreamOptions (buffering, deadlines).
websocket_optionsHandshake headers, framing, HTTP/2 and TLS settings.
Returns
The connected stream, or an error status. Drive it asynchronously via Start()/Send() once returned.

◆ GetRequestHeaders()

const HttpHeaders & a11::net::WebSocketWireStream::GetRequestHeaders ( ) const
inline

The headers the accepted request carried.

Empty for a client.

A per-connection credential arrives here, which is what lets a server authenticate a stream rather than a port.

◆ GetRequestPath()

const std::string & a11::net::WebSocketWireStream::GetRequestPath ( ) const
inline

The path this stream was accepted on, query string included.

Empty for a client stream, which knows where it dialled. On a server accepting under WebSocketServerOptions::path_prefix this is the only place the rest of the path survives, and so the only way a handler can serve more than one thing on one port.

Friends And Related Symbol Documentation

◆ WebSocketWireServer

friend class WebSocketWireServer
friend

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