Skip to main content

WebSocketCaptureRecorder

Trait WebSocketCaptureRecorder 

pub trait WebSocketCaptureRecorder:
    Send
    + Sync
    + 'static {
    // Required method
    fn record(
        &self,
        message: WebSocketMessage,
    ) -> impl Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send;
}
Available on crate features http and std only.
Expand description

Asynchronous recorder for complete Chromium-shaped WebSocket messages.

Each returned future must resolve only after the message has been persisted or accepted by bounded storage. This lets socket traffic apply backpressure without prescribing how implementations serialize concurrent calls.

The future may be dropped before it resolves when the WebSocket or its polling task is dropped. Implementations must therefore be cancellation-safe: a partially polled call must not corrupt recorder state or permanently retain capacity reserved for that message. A backend with cancellation-sensitive I/O can hand the message to an owned worker and await that worker’s acknowledgement.

Required Methods§

fn record( &self, message: WebSocketMessage, ) -> impl Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send

Record one WebSocket message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§