Simple SSE Dio

An implementation of the simple_sse SseClient interface using the dio package.

Features

Open an SSE connection and receive a stream of SseEvent objects using the simple_sse package behind the scenes.

Usage

Add this package to your app's dependencies:

dart pub add simple_sse_dio

Use the DioSseClient to open a connection and receive a stream of SseEvent objects.

final client = DioSseClient();
final Stream<SseEvent> events = client.connect(Uri.parse('https://sse.dev/test'));

await for (final SseEvent event in events) {
    // SseEvent(id: 123, event: 'event', data: 'data', retry: 123)
    print(event.toString()); 
}

Libraries

simple_sse_dio