Better HN
topnewbestaskshowjobs
Log inSign up

chalas_r

7 karma · joined Feb 11, 2015 (11y ago) · 2 submissions

OSS Maintainer, Symfony Core Team Member. https://github.com/chalasr
Submissions

comment 4y ago · link · parent

Actually neither the WebSocket nor the SSE browser APIs allow to send custom headers (see https://stackoverflow.com/q/4361173/4363634, https://stackoverflow.com/q/36201347/4363634). Point is that the Mercure protocol specifies the authorization part deeply so it's handled out of the box. With WebSocket you are on your own.

comment 4y ago · link · parent

Mercure is an alternative to WebSocket that is especially useful for REST/GraphQL APIs. It's a protocol that builds on HTTP and Server-Sent Events thus is supported out of the box by browsers, mobile apps and IoT clients, and it doesn't suffer from most WebSocket limitations (e.g. header/cookie based authorization works):

https://mercure.rocks