ssevents_client 0.1.0 copy "ssevents_client: ^0.1.0" to clipboard
ssevents_client: ^0.1.0 copied to clipboard

This implementation allows you to receive EventSource sent from the server.

ssevents_client #

A library for receive EventSource sent from the server.

Usage #

A simple usage example:

import 'package:ssevents_client/ssevents_client.dart';

main() async {
  SSE sse = SSE(Uri(scheme: 'http', host: 'localhost', port: 80),
      retry: Duration(seconds: 15));
  sse.onChangeState.listen((int state) {
    switch (state) {
      case 0:
        print('State: Connecting');
        break;
      case 1:
        print('State: Connected');
        break;
      case 2:
        print('State: Closed');
        break;
    }
  });
  sse.onMessage.listen((SSEMessage message) => print(message.toJson()));
  sse.connect();
}

Licensing #

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

2
likes
60
pub points
0%
popularity

Publisher

unverified uploader

This implementation allows you to receive EventSource sent from the server.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on ssevents_client