Notifications from your backend
Fill in the form and this site's backend publishes it with one HTTP request. Every window with this room open receives it.
Equivalent curl command
How it works
The browser listens on a public channel. Public channels need no join token: anyone who knows the name can subscribe, so use hard-to-guess names such as a per-user token for anything personal.
Publishing is an HTTP POST to /{channel}/{event} with a token made for that one request and
signed by one of the app's API keys. The response says how many connected clients received it. Because
only your backend holds the key, only your backend can publish.
const channel = pikoman.listen(`notify-${userToken}`);
channel.on("notification", ({ kind, title, message }) => {
showToast(kind, title, message);
});