EventFluxBase class abstract
Abstract base class for EventFlux connection management.
This class defines the core interface for managing connections in an EventFlux implementation. It declares methods for connecting, disconnecting, and reconnecting to an event stream.
Implementing classes are expected to provide concrete implementations for these methods, adhering to the behavior and specifications outlined here.
Methods:
-
connect
: Establishes a connection to an event stream based on the given parameters. This method must be implemented by subclasses to initiate a connection using the specified connection type, URL, headers, and optional body. It returns anEventFluxResponse
which encapsulates the connection status and potentially a stream ofEventFluxData
.- Parameters:
type
: TheEventFluxConnectionType
(GET or POST) indicating the type of HTTP connection.url
: The URL of the event stream to connect to.header
: Optional HTTP headers for the request. Defaults to accepting 'text/event-stream'.body
: Optional body for POST requests.
- Parameters:
-
disconnect
: Disconnects from the current event stream. This method must be implemented by subclasses to properly close any open connections and perform necessary cleanup. It returns anEventFluxStatus
indicating the result of the disconnection attempt. -
reconnect
: Re-establishes a connection to an event stream. This method should be implemented by subclasses to disconnect any existing connection and then reconnect using the provided parameters. It returns anEventFluxResponse
similar to theconnect
method.- Parameters:
type
: TheEventFluxConnectionType
(GET or POST) for the new connection.url
: The URL to reconnect to.
- Parameters:
Example Implementation:
class MyEventFlux extends EventFluxBase {
@override
EventFluxResponse connect(...) {
// implementation
}
@override
EventFluxStatus disconnect() {
// implementation
}
@override
EventFluxResponse reconnect(...) {
// implementation
}
}
This abstract class is central to ensuring a consistent interface for EventFlux connection management across different implementations.
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connect(
EventFluxConnectionType type, String url, {Map< String, String> header = const {'Accept' : 'text/event-stream'}, dynamic onConnectionClose()?, bool autoReconnect = false, dynamic onError(EventFluxException)?, Map<String, dynamic> ? body}) → EventFluxResponse -
disconnect(
) → Future< EventFluxStatus> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reconnect(
EventFluxConnectionType type, String url, {Map< String, String> header = const {'Accept' : 'text/event-stream'}, dynamic onConnectionClose()?, bool autoReconnect = false, dynamic onError(EventFluxException)?, Map<String, dynamic> ? body}) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited