Self-hosted push notification service
POST/api/messages
Send a notification to all connected clients.
curl -X POST /api/messages \
-H "Authorization: <token>" \
-H "Content-Type: application/json" \
-d '{"tag":"deploy", "title":"Deployed", "content":"v1.2.3 is live"}'
| Field | Type | Required | Description |
|---|---|---|---|
title | string | * | Message title |
content | string | * | Message body |
tag | string | No | Tag for filtering |
At least one of title or content is required.
Response:
{"id":"abc123","tag":"deploy","title":"Deployed","content":"v1.2.3 is live","timestamp":1711700000}
GET/api/stream
Long-lived Server-Sent Events connection for real-time push.
curl -N http://server:8083/api/stream
Events:
: connected
id: abc123
event: message
data: {"id":"abc123","tag":"deploy","title":"Deployed","content":"v1.2.3","timestamp":1711700000}
: keepalive
Keepalive sent every 30s by default (configurable via -keepalive). Client should auto-reconnect on disconnect.
GET/api/messages
Returns last 100 messages as JSON array.
| Param | Description |
|---|---|
after | Message ID — returns only messages after this ID (for catch-up) |
curl http://server:8083/api/messages?after=abc123
GET/health
{"status":"ok"}
Push requires token via Authorization header or ?token= query param.
Subscribe and history endpoints are public.
| Status | Meaning |
|---|---|
| 400 | Invalid request body |
| 401 | Missing or invalid token |