Skip to content
@drupflare/spool v1.0.0 GitHub
    Preparing search index...

    Type Alias LiveOpen

    what a hub needs to open one stream; everything but signal and valid crosses a Durable Object as JSON

    type LiveOpen = {
        first: LiveFrame[];
        keepaliveMs: number;
        leaseMs: number;
        maxAgeMs: number;
        partition: string | null;
        signal?: AbortSignal;
        socket?: boolean;
        valid?: () => boolean | Promise<boolean>;
    }
    Index
    first: LiveFrame[]

    events written first, in order: hello and the catch-up delta

    keepaliveMs: number

    milliseconds between keepalive comments

    leaseMs: number

    how long each lease event grants, in milliseconds; a lease follows first and then every half of it

    maxAgeMs: number

    the stream closes after this long, so the next connect resolves the identity again; 0 never

    partition: string | null

    the principal partition id the page holds; null for a public stream

    signal?: AbortSignal

    the request's abort signal; a stream closes when it aborts

    socket?: boolean

    true when the request is a WebSocket upgrade. A hub with sockets answers it with a socket; any other hub ignores it and answers the stream, which makes the page fall back to SSE.

    valid?: () => boolean | Promise<boolean>

    Called at each lease tick of a partition stream; false ends the session at once with revoked. A hub that runs in another isolate cannot take a function, so it ignores this and relies on LiveHub.revoke and maxAgeMs.