Skip to content

Allow using Mercure with other transports than SSE #616

@dunglas

Description

@dunglas

Mercure 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:

  • binary support is limited (binary data need to be base64-encoded)
  • while possible, it's not really adapted to send updates to a server

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:

  • As requested in Websub protocol #100, WebSub could be used to send updates to a server instead of to a client. As Mercure has been largely inspired by WebSub, adding WebSub as a new transport should be easy.
  • WebTransport and WebSockets could be proposed as alternative transports for binary data
  • Braid's subscribe feature could also be used if it gains traction (even if it would probably be a better idea to use Mercure for the subscribe feature of Braid)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pinnedThe issue must not be marked as stalespecSpec-related issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions