Libraries
    Preparing search index...
    • Wrap a server-sent event with a unique ID for resumable subscriptions.

      When a handler yields a TrackedEvent, the server sends the event with its ID. If the client disconnects and reconnects with the last received ID, the handler can skip already-delivered events.

      Type Parameters

      • T

      Parameters

      • id: string

        A unique, monotonically increasing identifier for this event.

      • data: T

        The event payload to send to the client.

      Returns TrackedEvent<T>

      A TrackedEvent wrapper.

      async function* handler({ incoming }) {
      yield tracked('evt-1', { message: 'Hello' });
      yield tracked('evt-2', { message: 'World' });
      }