Reference
Realtime
Push WebSocket and SSE payloads through the same render path as ordinary HTML requests.
Connect a stream
RGX exposes a `createRecyclrStream()` helper that can prefer WebSocket and fall back to SSE when needed.
const gx = new Recyclr();
const stream = Recyclr.createRecyclrStream({
wsUrl: '/realtime',
sseUrl: '/realtime',
gx
});
stream.start();
Payload shape
The realtime handler expects a payload that includes `html` and can optionally include `rules`, `presets`, or an event name.
- `html`: the fragment to evaluate.
- `rules`: explicit render rules when you want the server to dictate the mapping.
- `presets`: a named preset list when the server wants alternate mappings.
- `eventName`: the event dispatched after render completes.