Encode an envelope as one Server-Sent Events message: event: template, data: <envelope JSON>, then a blank line.
event: template
data: <envelope JSON>
sseEvent (web adapter) is the same function.
The envelope to send.
The SSE frame, "event: template\ndata: {…}\n\n".
"event: template\ndata: {…}\n\n"
import { Envelope, formatEvent } from '@anzaui/engine';formatEvent(new Envelope('feed', 1724771200, '<article>Live Post</article>'));// 'event: template\ndata: {"v":2,"slot":"feed","ts":1724771200,"html":"<article>Live Post</article>"}\n\n' Copy
import { Envelope, formatEvent } from '@anzaui/engine';formatEvent(new Envelope('feed', 1724771200, '<article>Live Post</article>'));// 'event: template\ndata: {"v":2,"slot":"feed","ts":1724771200,"html":"<article>Live Post</article>"}\n\n'
Encode an envelope as one Server-Sent Events message:
event: template,data: <envelope JSON>, then a blank line.sseEvent (web adapter) is the same function.