dunglas / mercure

🪽 An open, easy, fast, reliable and battery-efficient solution for real-time communications
https://mercure.rocks
GNU Affero General Public License v3.0
3.83k stars 278 forks source link

Allow using Mercure with other transports than SSE #616

Open dunglas opened 2 years ago

dunglas commented 2 years ago

Mercury is essentially a pub/sub protocol for resource representations in the sense of REST and HTTP. It allows a client to use the HTTP protocol to receive new versions of one or multiple resources. It also provides an advanced authorization system to ensure that a given client is allowed to receive a given update.

Currently, the spec is tight to the Server-Sent Event protocol. While SSE is a good default and is better than most other solutions for the common use cases, it also has some limitations:

Most of the spec is already transport-independent, and it could be useful for some use cases to allow using the Mercure protocol with other transports than SSE:

I propose to explicitly state in the spec that Mercure can be used with different transport. To move the parts of the spec related to SSE in a dedicated "SSE transport" section and to a new "WebSub" transport section. WebSockets, WebTransports, and Braid transports could be defined as other specs later if asked by the community.

gedw99 commented 1 year ago

Websub is something i have used before. Would be pretty nice for it to be part of Mercure.

@dunglas Do you know if there is any code to look at yet to hack on in a branch ?