SseClient class

A client for Server-Sent Events (SSE) with automatic reconnection.

Constructors

SseClient({Client? httpClient, Duration idleTimeout = const Duration(seconds: 45), BackoffStrategy? backoffStrategy, int maxDataCodeUnits = 8 * 1024 * 1024})
Creates a new SSE client.

Properties

hashCode int
The hash code for this object.
no setterinherited
isConnected bool
Check if the client is currently connected.
no setter
lastEventId String?
Get the last event ID received.
no setter
maxDataCodeUnits int
Maximum number of UTF-16 code units allowed in a single SSE data block.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Close the connection and clean up resources.
connect(Uri url, {Map<String, String>? headers, Duration? requestTimeout}) Stream<SseMessage>
Connect to an SSE endpoint and return a stream of messages.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseStream(Stream<List<int>> stream, {Map<String, String>? headers}) Stream<SseMessage>
Parse an existing byte stream as SSE messages.
toString() String
A string representation of this object.
inherited

Operators

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