Remote / foldkit-remote/live

observeLive

function · packages/remote/src/live.ts:174

function observeLive<
  AppModel,
  Store extends RemoteModel,
  Names extends string,
  Model,
  SurfaceMessage,
  Params,
  Message = RemoteMessage,
>(
  bound: BoundRemote<AppModel, Store, Names>,
  surface: Surface<AppModel, Model, SurfaceMessage, Params>,
  params: Params,
  toMessage?: (message: RemoteMessage) => Message,
  options?: LiveOptions,
): EntryWithoutKeepAlive<AppModel, Message, LiveDependencies, RemoteClient>

A Foldkit Subscription entry that consumes the live stream for a Surface's requirements, every row it reads and each list it reads live, emitting a LiveReceived per event and a ReadFailed carrying its stream when the stream breaks (including ResumeUnavailable). That records a gap on the stream rather than a failed read, since nothing was being read, and restarts the entry after a backoff; the restart refetches what it covers. The resume cursor is read from RemoteModel.live, so the application tracks no cursor of its own. Data.subscriptions makes these for an active record.