Optional Bedrock/JSON convenience layer over the core codec.
Classifies each frame by its :message-type header (event / exception /
error) — before :event-type — into idiomatic tagged tuples, and
unwraps Bedrock JSON payloads ({"bytes": base64} or direct JSON). Requires
the optional :jason dependency.
Summary
Functions
Classify one decoded frame by its :message-type header.
Types
Functions
@spec classify(AWSEventStream.Message.t()) :: classified()
Classify one decoded frame by its :message-type header.
A frame's classification comes from its headers, so :message-type is checked
before :event-type. Crucially, an exception/error frame is always
surfaced as {:exception, …} / {:error, …} — a payload that fails to decode
never downgrades a server-side close to {:malformed_payload, …}, since a
close may legitimately carry a non-JSON or empty body. For an exception frame
whose body is not a JSON object, the raw bytes are preserved under "raw".
Only event frames (the normal data path) surface {:malformed_payload, …}
when their payload can't be decoded.