Type Alias LiveOptions
type LiveOptions = {
hub?: LiveHub;
keepalive?: number;
lease?: number;
maxAge?: number;
mode?: "adaptive" | "always";
public?: boolean;
}
hub?: LiveHub;
keepalive?: number;
lease?: number;
maxAge?: number;
mode?: "adaptive" | "always";
public?: boolean;
}
The
liveoption ofcreateSpool.hubis where streams live; omitted, an in-process hub, which only suits one long-lived process.publicalso pushes tag changes to pages that hold no principal partition. Seconds:leaseis what each lease event grants (default 120),keepalivethe gap between comments (default 25) andmaxAgehow long one stream lives before the page connects again and the identity is resolved again (default 3600; 0 never).modedecides 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.alwaysopens 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 asdurableObjectHub(ns, { hibernate: true }), also answers a WebSocket upgrade at the same path, and pages open a socket first.keepaliveandmaxAgestill apply to SSE streams; a socket has no keepalive comment, since its ping is the page's, and ends atmaxAge.