pub struct WebSocketMessage {
pub type: WebSocketMessageType,
pub time: f64,
pub opcode: WebSocketMessageOpcode,
pub data: ArcStr,
}Expand description
A Chrome DevTools WebSocket message stored in an HAR entry’s
_webSocketMessages extension.
Chrome exports complete text and binary messages rather than fragmented wire frames, plus protocol errors. Control frames and connection-close events are not included. The shape is unchanged from the Chrome 76 announcement and the current Chromium DevTools HAR exporter.
Fields§
§type: WebSocketMessageTypeWhether the message was sent, received, or reports a protocol error.
time: f64Unix timestamp in seconds, including any fractional part.
Unlike HAR’s startedDateTime, Chromium emits this as a JSON number.
opcode: WebSocketMessageOpcodeWebSocket opcode, or WebSocketMessageOpcode::ERROR for an error record.
data: ArcStrMessage payload.
Text messages and error records contain their original text. Chromium’s DevTools Protocol supplies non-text message data as base64, so binary messages use a base64 string here.
Implementations§
Source§impl WebSocketMessage
impl WebSocketMessage
Sourcepub fn new(
type: WebSocketMessageType,
time: f64,
opcode: WebSocketMessageOpcode,
data: impl Into<ArcStr>,
) -> Self
pub fn new( type: WebSocketMessageType, time: f64, opcode: WebSocketMessageOpcode, data: impl Into<ArcStr>, ) -> Self
Create a message with an explicitly supplied opcode and already encoded data.
Sourcepub fn text(
type: WebSocketMessageType,
time: f64,
data: impl Into<ArcStr>,
) -> Self
pub fn text( type: WebSocketMessageType, time: f64, data: impl Into<ArcStr>, ) -> Self
Create a text message (opcode: 1).
Sourcepub fn binary(
type: WebSocketMessageType,
time: f64,
data: impl AsRef<[u8]>,
) -> Self
pub fn binary( type: WebSocketMessageType, time: f64, data: impl AsRef<[u8]>, ) -> Self
Create a binary message (opcode: 2), base64-encoding the supplied bytes.
Sourcepub fn binary_with_opcode(
type: WebSocketMessageType,
time: f64,
opcode: WebSocketMessageOpcode,
data: impl AsRef<[u8]>,
) -> Self
pub fn binary_with_opcode( type: WebSocketMessageType, time: f64, opcode: WebSocketMessageOpcode, data: impl AsRef<[u8]>, ) -> Self
Create a non-text message and base64-encode its payload.
Sourcepub fn error(time: f64, message: impl Into<ArcStr>) -> Self
pub fn error(time: f64, message: impl Into<ArcStr>) -> Self
Create the error record shape used by Chromium (type: "error", opcode: -1).
Sourcepub fn binary_data(&self) -> Option<Result<Vec<u8>, DecodeError>>
pub fn binary_data(&self) -> Option<Result<Vec<u8>, DecodeError>>
Decode a binary message’s base64 payload.
Returns None for other opcodes. A malformed base64 payload remains visible
as a decode error instead of being silently discarded.
Trait Implementations§
Source§impl Clone for WebSocketMessage
impl Clone for WebSocketMessage
Source§impl Debug for WebSocketMessage
impl Debug for WebSocketMessage
Source§impl<'de> Deserialize<'de> for WebSocketMessage
impl<'de> Deserialize<'de> for WebSocketMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for WebSocketMessage
impl PartialEq for WebSocketMessage
Source§impl Serialize for WebSocketMessage
impl Serialize for WebSocketMessage
impl StructuralPartialEq for WebSocketMessage
Auto Trait Implementations§
impl Freeze for WebSocketMessage
impl RefUnwindSafe for WebSocketMessage
impl Send for WebSocketMessage
impl Sync for WebSocketMessage
impl Unpin for WebSocketMessage
impl UnsafeUnpin for WebSocketMessage
impl UnwindSafe for WebSocketMessage
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
Source§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writerSource§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writerSource§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writerSource§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writerSource§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer