mercure_client 0.0.5

Dart native js
Flutter Android iOS web

Provide a quick way to publish and consume messages on Mercure

Provide a quick way to publish and consume messages on Mercure.

The features #

This project use Dio as HTTP client for making get request and listen for server side event.

Consuming messages #

import 'package:mercure_client/mercure_client.dart';

main() {
  final Mercure mercure = Mercure(
    'http://example.com/.well-known/mercure', // your mercure hub url
    '/books/{id}', // your mercure topic
  );

  mercure.subscribe((event) {
    print(event.data);
  });
}

Publishing Messages #

Mercure.publish(
  url: 'http://example.com/.well-known/mercure',
  topic: '/books',
  data: 'some data',
).then((response) {
  print(response.statusCode);
});
2
likes
110
pub points
38%
popularity

Publisher

herve-guigoz.com

Provide a quick way to publish and consume messages on Mercure

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

dio, meta

More

Packages that depend on mercure_client