Fork 0
A dart-eventsource fork that adds Authentication headers.
Go to file
Sudharshan S. 0368fb1fc3
fix: authToken handling
2019-03-23 23:32:21 +08:00
example Initial version 2016-11-27 21:31:19 +01:00
lib fix: authToken handling 2019-03-23 23:32:21 +08:00
test Update to support Dart v2 2018-10-09 17:48:05 +01:00
.gitignore Initial version 2016-11-27 21:31:19 +01:00
CHANGELOG.md Initial version 2016-11-27 21:31:19 +01:00
LICENSE Initial version 2016-11-27 21:31:19 +01:00
README.md Added SSE spec and corrected naming error 2016-11-28 12:44:18 +01:00
pubspec.yaml bump v0.2.1 2018-11-21 10:39:18 +00:00



A library for using EventSource or Server-Sent Events (SSE). Both client and server functionality is provided.

This library implements the interface as described here.

Client usage

For more advanced usage, see the example/ directory. 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());

Server usage

We recommend using shelf_eventsource for serving Server-Sent Events. This library provides an EventSourcePublisher that manages subscriptions, channels, encoding. We refer to documentation in the shelf_eventsource package for more information.

This library also includes a server provider for dart:io's HttpServer in io_server.dart. However, it has some issues with data flushing that are yet to be resolved, so we recommend using shelf instead.


This project is available under the MIT license, as can be found in the LICENSE file.