Mercure is an open protocol for real-time communications designed to be fast, reliable and battery-efficient. It is a modern and convenient replacement for both the Websocket API and the higher-level libraries and services relying on it.
Mercure is especially useful to add streaming capabilities to REST and GraphQL APIs. Because it is a thin layer on top of HTTP and SSE, Mercure is natively supported by modern web browsers, mobile applications and IoT devices.
Make sure you change in .platform/applications.yaml
MERCURE_PUBLISHER_JWT_KEY='!ChangeMe!'
MERCURE_SUBSCRIBER_JWT_KEY='!ChangeMe!'
You probably also want to disable the demo/ui in:
mercure/Caddyfile.platform_sh
and possibly allowing anonymous users.
For Mercure: Kévin Dunglas, all rights reserved.
$MERCURE_VERSION="0.14.0"
wget https://github.com/dunglas/mercure/releases/download/v{$MERCURE_VERSION}/mercure_{$MERCURE_VERSION}_Linux_x86_64.tar.gz
gunzip mercure_{$MERCURE_VERSION}_Linux_x86_64.tar.gz
tar xvf mercure_{$MERCURE_VERSION}_Linux_x86_64.tar
.platform.app.yaml
mounts:
'db':
source: local
source_path: db
.platform/routes.yaml
"https://mercure.{default}/":
type: upstream
upstream: "mercure:http"
cache:
enabled: false
Andin .platform.app.yaml
locations:
/:
allow: false
passthru: true
request_buffering:
enabled: false
SERVER_NAME=:$PORT
MERCURE_PUBLISHER_JWT_KEY='!ChangeMe!'
MERCURE_SUBSCRIBER_JWT_KEY='!ChangeMe!'
./mercure run -config Caddyfile.platform_sh