SSEClient class abstract
An SSEClient that works to maintain a SSE connection to a server.
You can receive MessageEvents by listening to the stream object. The SSEClient will connect when there is a nonzero number of subscribers on stream and will disconnect when there are zero subscribers on 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.
Constructors
-
SSEClient(Uri uri, Set<
String> eventTypes, {Map<String, String> headers = defaultHeaders, Duration connectTimeout = defaultConnectTimeout, Duration readTimeout = defaultReadTimeout, String? body, SseHttpMethod httpMethod = SseHttpMethod.get}) -
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<
MessageEvent> -
Subscribe to this stream to receive events and sometimes errors. The first
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
Constants
- defaultConnectTimeout → const Duration
-
defaultHeaders
→ const Map<
String, String> - defaultReadTimeout → const Duration