w3c_event_source

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

w3c event source

w3c_event_source #


W3C EventSource client implementation for Dart / Flutter.

This package depends on dart:io, so it is not usable on the Web.
If you'd like to contribute a wrapper around dart:html's EventSource, feel free!

Install #
Add to your pubspec.yaml:
dependencies:
w3c_event_source: ^1.3.2
copied to clipboard
Usage #
import 'dart:async';
import 'package:w3c_event_source/event_source.dart';

final events = EventSource(Uri.parse('http://api.example.com/ssedemo.php'));

// Listening on the `events` stream will open a connection.
final subscription = events.events.listen((MessageEvent message) {
print('${message.name}: ${message.data}');
});

Timer(Duration(seconds: 30), () {
// Canceling the subscription closes the connection.
subscription.cancel();
});
copied to clipboard
License #
MIT

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.