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.

example/main.dart

import '../lib/ssevents_client.dart';

void main(List<String> args) {
  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();
}
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