mercure_client 1.0.0-beta copy "mercure_client: ^1.0.0-beta" to clipboard
mercure_client: ^1.0.0-beta copied to clipboard

outdated

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() async {
  final Mercure mercure = Mercure(
    'http://example.com/.well-known/mercure', // your mercure hub url
    '/books/{id}', // your mercure topic
  );

  await 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);
});
8
likes
0
pub points
73%
popularity

Publisher

verified publisherherve-guigoz.com

Provide a quick way to publish and consume messages on Mercure

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio

More

Packages that depend on mercure_client