@anzaui/engine - v0.6.0
    Preparing search index...

    Function formatPacket

    • Encode an envelope as a WebSocket text message (the envelope JSON).

      Parameters

      • envelope: Envelope

        The envelope to send.

      Returns string

      The compact envelope JSON, '{"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