Encode an envelope as a WebSocket text message (the envelope JSON).
The envelope to send.
The compact envelope JSON, '{"v":2,"slot":…}'.
'{"v":2,"slot":…}'
import { Envelope, formatPacket } from '@anzaui/engine';const text = formatPacket(new Envelope('notifications', 1724771200, '<ui-toast>Order Shipped</ui-toast>'));socket.send(text); // with your WebSocket library Copy
import { Envelope, formatPacket } from '@anzaui/engine';const text = formatPacket(new Envelope('notifications', 1724771200, '<ui-toast>Order Shipped</ui-toast>'));socket.send(text); // with your WebSocket library
Encode an envelope as a WebSocket text message (the envelope JSON).