Permalink
Browse files

Add schemas

  • Loading branch information...
dunglas committed Nov 1, 2018
1 parent 1127dcc commit a9f532b1eb910d1b06b6d2d2ecc3831292295a1f
Showing with 10 additions and 1 deletion.
  1. +6 −1 README.md
  2. BIN spec/discovery.png
  3. +4 −0 spec/mercure.md
  4. BIN spec/subscriptions.png
@@ -9,6 +9,8 @@
Mercure is a protocol allowing to push data updates to web browsers and other HTTP clients in a convenient, fast, reliable and battery-efficient way.
It is especially useful to publish real-time updates of resources served through web APIs, to reactive web and mobile apps.
![Subscriptions Schema](spec/subscriptions.png)
The protocol has been published as [an Internet Draft](https://datatracker.ietf.org/doc/draft-dunglas-mercure/) that [is maintained in this repository](spec/mercure.md).
A reference, production-grade, implementation of **a Mercure hub** (the server) is also available here.
@@ -68,6 +70,8 @@ fetch('https://example.com/books/1') // Has this header `Link: <https://example.
});
```
![Discovery Schema](spec/discovery.png)
To dispatch an update, the publisher (an application server, a web browser...) just need to send a `POST` HTTP request to the hub.
Example using [Node.js](https://nodejs.org/) / [Serverless](https://serverless.com/):
@@ -277,4 +281,5 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
## Credits
Created by [Kévin Dunglas](https://dunglas.fr). Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).
Created by [Kévin Dunglas](https://dunglas.fr). Schemas by [Laury Sorriaux](https://github.com/ginifizz).
Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).
BIN +173 KB spec/discovery.png
Binary file not shown.
@@ -43,6 +43,8 @@ The keywords **MUST**, **MUST NOT**, **REQUIRED**, **SHALL**, **SHALL NOT**, **S
# Discovery
![Discovery Schema](discovery.png)
If the publisher is a server, it **SHOULD** advertise the URL of one or more hubs to the subscriber, allowing it to receive live updates when topics are updated.
If more than one hub URL is specified, it is expected that the publisher notifies each hub, so the subscriber **MAY** subscribe to one or more of them.
@@ -81,6 +83,8 @@ Note: the discovery mechanism described in this section [is strongly inspired fr
# Subscriptions
![Subscriptions Schema](subscriptions.png)
The subscriber subscribes to an URL exposed by a hub to receive updates of one or many topics.
To subscribe to updates, the client opens an HTTPS connection following the [Server-Sent Events specification](https://html.spec.whatwg.org/multipage/server-sent-events.html) to the hub's subscription URL advertised
by the Publisher. The `GET` HTTP method must be used.
Binary file not shown.

0 comments on commit a9f532b

Please sign in to comment.