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

    Type Alias LiveOptions

    The live option of createSpool. hub is where streams live; omitted, an in-process hub, which only suits one long-lived process. public also pushes tag changes to pages that hold no principal partition. Seconds: lease is what each lease event grants (default 120), keepalive the gap between comments (default 25) and maxAge how long one stream lives before the page connects again and the identity is resolved again (default 3600; 0 never).

    mode decides when a page opens its stream. adaptive, the default, makes the first lease renewal of a visible session an ordinary request and replaces the second with the stream, so a visitor who loads documents, each a short page lifetime, never opens one and pays what it pays without the option. always opens at login and whenever a tab becomes visible, for an app that stays open. live: 'always' is the same as { mode: 'always' }.

    A hub with sockets, such as durableObjectHub(ns, { hibernate: true }), also answers a WebSocket upgrade at the same path, and pages open a socket first. keepalive and maxAge still apply to SSE streams; a socket has no keepalive comment, since its ping is the page's, and ends at maxAge.

    type LiveOptions = {
        hub?: LiveHub;
        keepalive?: number;
        lease?: number;
        maxAge?: number;
        mode?: "adaptive" | "always";
        public?: boolean;
    }
    Index
    hub?: LiveHub
    keepalive?: number
    lease?: number
    maxAge?: number
    mode?: "adaptive" | "always"
    public?: boolean