Skip to content
D
Documentation

SyncAdapterOptions

reference
1 min readUpdated

Import it from @grafloria/engine.

ts
interface SyncAdapterOptions

Properties

NameTypeDefaultDescription
batch?Omit<OpBatcherOptions, 'onFlush'> | falseBatching. false sends every op the instant it happens — legal, and a bad idea.
relay?booleanForward ops that were NEW to us on to our other peers.
syncIntervalMs?numberPeriodic anti-entropy, ms. 0 disables it (the tests drive sync() by hand).
heartbeatMs?numberRe-publish our awareness this often, so peers do not time us out while we sit still. Default: a third of {@link awarenessTimeoutMs} (5 s with the defaults). 0 turns the heartbeat off; peers then expire anyone silent for the timeout, idle or not.
awarenessThrottleMs?numberMinimum ms between awareness sends. 60Hz in, ~20Hz out.
awarenessTimeoutMs?numberDrop a peer's presence (its cursor, selection and name) after this long without a word from it. Default 15 s. Checked on a timer, so a peer that crashes without saying goodbye is removed within about the timeout plus a third of it. A peer that leaves cleanly is removed at once.
setTimer?(cb: () => void, ms: number) => unknownInjectables, so every timing test is deterministic instead of a race.
clearTimer?(handle: unknown) => void
setInterval?(cb: () => void, ms: number) => unknown
clearInterval?(handle: unknown) => void
now?() => number

Was this page helpful?

SyncAdapterOptions — Grafloria