SseParser class final

Transforms a stream of SSE lines into a stream of MercureEvents.

Follows the SSE specification parsing rules:

  • Lines starting with : are comments (ignored)
  • Multiple data: fields are concatenated with \n
  • id: must not contain U+0000 NULL (ignored if it does)
  • retry: must be all digits (ignored otherwise)
  • Unknown fields are ignored
  • An empty line dispatches the accumulated event

Events whose accumulated data: fields exceed maxEventSize bytes are discarded and a StateError is added to the output stream.

Used only by the dart:io transport — the web transport receives already-parsed events from the browser's native EventSource.

Implemented types

Constructors

SseParser({int maxEventSize = 10 * 1024 * 1024})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
maxEventSize int
Maximum allowed event size in bytes (accumulated data: fields). Events exceeding this limit are discarded and an error is emitted. Defaults to 10 MB.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bind(Stream<String> stream) Stream<MercureEvent>
Transforms the provided stream.
override
cast<RS, RT>() StreamTransformer<RS, RT>
Provides a StreamTransformer<RS, RT> view of this stream transformer.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited