EventSourcePublisher class
An EventSource publisher. It can manage different channels of events.
This class forms the backbone of an EventSource server. To actually serve
a web server, use this together with shelf_eventsource
or another server
implementation.
Constructors
- EventSourcePublisher({int cacheCapacity = 0, bool comparableIds = false, bool enableLogging = true})
- Create a new EventSource server.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- logger ↔ Logger?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
Event event, {Iterable< String> channels = const [""]}) → void -
Add a publication to the specified channels.
By default, only adds to the default channel.
override
-
channel(
String channel) → Sink< Event> -
Creates a Sink for the specified channel.
The
add
andremove
methods of this channel are equivalent to the respective methods of this class with the specific channel passed along. -
close(
{Iterable< String> channels = const [""]}) → void -
Close the specified channels.
All the connections with the subscribers to this channels will be closed.
By default only closes the default channel.
override
-
closeAllChannels(
) → void - Close all the open channels.
-
newSubscription(
{required void onEvent(Event), required void onClose(), required String channel, String? lastEventId}) → void - Initialize a new subscription and replay when possible. Should not be used by the user directly.
-
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