pub struct WebSocketFrameDriver { /* private fields */ }Expand description
Transport-neutral WebSocket liminal driver.
One driver owns one socket lifetime: it opens at most once and mints at most one terminal fate. Reconnecting means a fresh driver under a fresh aggregate-issued authorization — the driver itself can never re-open.
Implementations§
Source§impl WebSocketFrameDriver
impl WebSocketFrameDriver
Sourcepub const fn phase(&self) -> DriverPhase
pub const fn phase(&self) -> DriverPhase
Current lifecycle phase.
Sourcepub const fn has_outstanding_exchange(&self) -> bool
pub const fn has_outstanding_exchange(&self) -> bool
Reports whether one correlated exchange is outstanding.
Sourcepub const fn command_open(&mut self) -> Result<SocketCommand, CommandRefusal>
pub const fn command_open(&mut self) -> Result<SocketCommand, CommandRefusal>
Emits the single open command of this driver lifetime.
§Errors
Returns CommandRefusal::InvalidPhase unless the driver is idle.
Sourcepub fn command_send(
&mut self,
bytes: Vec<u8>,
expectation: ResponseExpectation,
) -> Result<SocketCommand, CommandRefusal>
pub fn command_send( &mut self, bytes: Vec<u8>, expectation: ResponseExpectation, ) -> Result<SocketCommand, CommandRefusal>
Emits a send command for one canonical frame image.
§Errors
Returns CommandRefusal::InvalidPhase unless the socket is
established, and CommandRefusal::ExchangeOutstanding when a
correlated exchange is already in flight (the Q-B rule).
Sourcepub const fn command_close(&mut self) -> Result<SocketCommand, CommandRefusal>
pub const fn command_close(&mut self) -> Result<SocketCommand, CommandRefusal>
Emits the close command, moving the driver into the closing phase.
The commanded close is not itself terminal: the echoed close event
mints TransportTerminal::CloseCompleted (F3).
§Errors
Returns CommandRefusal::InvalidPhase unless the socket is opening
or established.
Sourcepub fn handle_event(&mut self, event: SocketEvent) -> DriverStep
pub fn handle_event(&mut self, event: SocketEvent) -> DriverStep
Handles one closed socket event and returns the driver’s decision.