A library for using EventSource or Server-Side Events (SSE). Both client and server functionality is provided.
For more advanced usage, see the
Creating a new EventSource client is as easy as a single call.
The http package is used under the hood, so wherever this package works, this lbirary will also work.
Browser usage is slightly different.
EventSource eventSource = await EventSource.connect("http://example.com/events"); // in browsers, you need to pass a http.BrowserClient: EventSource eventSource = await EventSource.connect("http://example.com/events", client: new http.BrowserClient());
We recommend using
serving Server-Side Events.
This library provides an
EventSourcePublisher that manages subscriptions, channels, encoding.
We refer to documentation in the
package for more information.
This library also includes a server provider for
However, it has some issues with data flushing that are yet to be resolved, so we recommend using
This project is available under the MIT license, as can be found in the LICENSE file.