SSEClient class abstract

An SSEClient that works to maintain a SSE connection to a server.

You can receive Eventss by listening to the stream object. The SSEClient will connect when there is a nonzero number of subscribers on the stream and will disconnect when there are zero subscribers on the stream. In certain cases, unrecoverable errors will be reported on the stream at which point the stream will be done.

The SSEClient will make best effort to maintain the streaming connection.

Implementers

Constructors

SSEClient.new(Uri uri, Set<String> eventTypes, {Map<String, String> headers = defaultHeaders, Duration connectTimeout = defaultConnectTimeout, Duration readTimeout = defaultReadTimeout, String? body, SseHttpMethod httpMethod = SseHttpMethod.get, EventSourceLogger? logger})
Factory constructor to return the platform implementation.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<Event>
Subscribe to this stream to receive events and sometimes errors. subscribe triggers the connection, so expect network delay initially.
no setter

Methods

close() Future
Closes the SSEClient and tears down connections and resources. Do not use the SSEClient after close is called, behavior is undefined at that point.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restart() → void
Request that the SSEClient drops the current connection and then establishes a new connection respecting delay/backoff as if this was an error condition with the connection.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

testClient(Uri uri, Set<String> eventTypes, {Map<String, String> headers = defaultHeaders, Duration connectTimeout = defaultConnectTimeout, Duration readTimeout = defaultReadTimeout, String? body, SseHttpMethod httpMethod = SseHttpMethod.get, Stream<Event>? sourceStream}) TestSseClient
Get an SSE client for use in unit tests.