mercure_dart library

Pure Dart implementation of the Mercure protocol.

See https://mercure.rocks/spec for the protocol specification.

Classes

Bearer
Bearer token authentication via the Authorization header.
Cookie-based authentication.
DiscoveryResult
Result of a Mercure hub discovery.
LinkEntry
A parsed entry from an HTTP Link header.
MercureAuth
Authentication strategy for Mercure hub requests.
MercureEvent
A parsed Server-Sent Event received from a Mercure hub.
MercurePublisher
Public API for publishing updates to a Mercure hub.
MercureSubscriber
Public API for subscribing to Mercure hub updates.
MercureSubscriptionsApi
Client for the Mercure Subscriptions API.
MercureTransport
Platform-agnostic transport interface for Mercure hub communication.
MercureTransportPlatform
Stub transport that throws on every call.
PublishOptions
Options for publishing an update to a Mercure hub.
QueryParam
Query parameter authentication.
SseLineDecoder
Transforms a stream of byte chunks into a stream of lines.
SseParser
Transforms a stream of SSE lines into a stream of MercureEvents.
SubscriptionInfo
A single subscription from the Mercure Subscriptions API.
SubscriptionsResponse
The response from the Mercure Subscriptions API.
TransportResponse
Raw HTTP response from a MercureTransport.get call.

Functions

createMercureTransport() MercureTransport
Factory function to create the platform transport.
discoverMercureHub(String resourceUrl, {MercureAuth? auth, MercureTransport? transport}) Future<DiscoveryResult>
Discovers the Mercure hub URL(s) for a given resource.
parseLinkHeader(String header) List<LinkEntry>
Parses an HTTP Link header value into a list of LinkEntry.