ssevents/decoder
Full-body and incremental SSE decoding.
Semantics chosen for the initial release:
- accepted line endings: LF and CRLF
- unknown fields are ignored
- EOF dispatches the final unterminated event or trailing comment
- the first decode error fails the whole operation
- retry values must be ASCII digits and must not exceed
Limits.max_retry_value
Types
pub opaque type DecodeState
Values
pub fn decode(
input: String,
) -> Result(List(event.Item), error.SseError)
pub fn decode_bytes(
input: BitArray,
) -> Result(List(event.Item), error.SseError)
pub fn decode_bytes_with_limits(
input: BitArray,
limits limits: limit.Limits,
) -> Result(List(event.Item), error.SseError)
pub fn decode_with_limits(
input: String,
limits limits: limit.Limits,
) -> Result(List(event.Item), error.SseError)
pub fn finish(
state: DecodeState,
) -> Result(List(event.Item), error.SseError)
pub fn new_decoder() -> DecodeState
pub fn new_decoder_with_limits(
limits: limit.Limits,
) -> DecodeState
pub fn push(
state: DecodeState,
chunk: BitArray,
) -> Result(#(DecodeState, List(event.Item)), error.SseError)