Super simple, type‑safe realtime via Server‑Sent Events (SSE).
CLI (Node):
npx @impulselab/realtime-service --port 8080 --secret "$REALTIME_SECRET"Docker:
docker run \
-p 8080:8080 \
-e REALTIME_SECRET="your-server-secret" \
ghcr.io/impulse-studio/realtime-serviceEndpoints: GET / (SSE stream), POST / (push).
Define your channel → payload map once, share it on client and server:
interfaceRealtimeTypes{'this:is:a:channel': {key: string}}import{createRealtimeClient}from'@impulselab/realtime'constrc=createRealtimeClient<RealtimeTypes>({serviceUrl: process.env.SERVICE_URL!})// Public subscriberc.subscribe('this:is:a:channel',(event)=>{console.log(event.payload.key)})// Private subscribe (token) or group (topic)rc.subscribe('this:is:a:channel',(event)=>{console.log(event.payload.key)},{token: 'secret',topic: 'room-42'})// Unsubscribe helpersconstoff=rc.subscribe('this:is:a:channel',()=>{})off()rc.unsubscribeAll('this:is:a:channel')rc.unsubscribeAllChannels()import{createServerClient}from'@impulselab/realtime'constsc=createServerClient<RealtimeTypes>({serviceUrl: process.env.SERVICE_URL!,token: process.env.TOKEN!})// Public pushawaitsc.push('this:is:a:channel',{key: 'value'})// Authenticated push (token)awaitsc.push('this:is:a:channel',{key: 'value'},{tokens: 'secret'})// Target a topic (room/group)awaitsc.push('this:is:a:channel',{key: 'value'},{topic: 'room-42'})// Auth + topic togetherawaitsc.push('this:is:a:channel',{key: 'value'},{tokens: ['secret','other'],topic: 'room-42'})