#[non_exhaustive]pub enum WsFrame {
StateChange(StateChange),
Response(JmapResponse),
Unknown {
type_name: String,
raw: Value,
},
}Expand description
A parsed frame received from the JMAP WebSocket.
Marked #[non_exhaustive] because the spec may define additional
@type values in future revisions.
§Debug redaction
WsFrame has a hand-written std::fmt::Debug impl rather than
#[derive(Debug)] so the Unknown::raw field is
printed as [REDACTED] instead of being serialised verbatim. See the
field doc on Unknown.raw for the credential-leak class this guards
against (bd:JMAP-6r7c.5). Use the structured accessors on the frame
itself, not {:?}, when you need the raw value.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
StateChange(StateChange)
RFC 8620 §7.1 StateChange — one or more object types have changed state; client must re-fetch the affected data types.
Response(JmapResponse)
RFC 8887 Response — reply to a JMAP request sent on this connection.
Unknown
Unrecognized @type — silently ignored per forward-compatibility rules
(RFC 8887 §4.3.1: clients SHOULD ignore unknown message types).
Also produced when a known type ("Response" or "StateChange") fails
to deserialize — type_name will be "Response" or "StateChange" in
that case, which can signal server misbehavior or a schema version
mismatch. Callers that log unknown frames should check for these names.
Fields
type_name: StringValue of the @type field. Either an unrecognized message type
per RFC 8887 §4.3.1, or "Response" / "StateChange" when a known
type failed to deserialize into its typed variant.
raw: ValueRaw JSON object as received from the server, preserved for forward-compatibility diagnostics.
DO NOT log this field verbatim. Future or extension JMAP
WebSocket message types may carry credential-grade material —
push verification codes (RFC 8887 §7.2), federation handshake
tokens, session-rotation challenges, etc. — and a malformed
Response to a method like PushSubscription/get can echo a
verificationCode back into this field.
The enclosing WsFrame uses a hand-written Debug impl that
renders this field as [REDACTED] to neutralise the natural
{:?}-leaks-the-field failure mode (bd:JMAP-6r7c.5). For
operator logs, prefer logging type_name only, or apply a
project-specific redaction filter before passing raw to a
logging sink. See bd:JMAP-sc1b.98.