Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/stevenroose/dart-shelf_eventsource

A shelf handler for Server-Side Events (SSE).
https://github.com/stevenroose/dart-shelf_eventsource

Last synced: 3 months ago
JSON representation

A shelf handler for Server-Side Events (SSE).

Awesome Lists containing this project

README

        

# shelf_eventsource

A shelf extension for EventSource or Server-Sent Events (SSE) that works together with the
[eventsource](https://pub.dartlang.org/packages/eventsource) package.

# How to use it?

The usage is really easy:
```dart
import "package:shelf/shelf_io.dart" as io;
import "package:eventsource/publisher.dart";
import "package:shelf_eventsource/shelf_eventsource.dart";

EventSourcePublisher publisher = new EventSourcePublisher(cacheCapacity: 100);
var handler = eventSourceHandler(publisher);
io.serve(handler, "localhost", 8080);
```

For a more extensive example with routing, see the `example/` directory.

## Licensing

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