Rxova
Skip to content

SharedStoreOptions

Type ParameterDefault type
SRecord<string, unknown>
optional accept?: (meta) => boolean;

Gatekeeper for incoming remote writes (patches and snapshot merges): return false to ignore them. Lets callers delimit how much is shared — e.g. accept only writes from other tabs, not from workers.

ParameterType
metaMessageMeta

boolean


optional kind?: PeerKind;

What this client announces itself as. Defaults to ‘worker’ when there is no document, else ‘tab’.

CommonOptions.kind


readonly optional onInvalid?: OnInvalid;

Observe validation failures instead of the default development warning.

SchemaOptions.onInvalid


optional persist?: PersistOptions;

Restore this store on creation and write it back as it changes.


readonly optional schema?: SchemaMap<S>;

Validate payloads against a Standard Schema before trusting them — any Zod, Valibot or ArkType schema, or anything else exposing ~standard.

Without this, an inbound payload is cast, not checked: a peer running last week’s deploy sends whatever that build thought the shape was, and the receiving code reads it as whatever this build’s types say. That is the one place in this library where a type is a hope rather than a guarantee, and a rolling deploy is what turns it into a bug.

Validation runs in both directions. Inbound, a failure drops the payload — the same choice the envelope makes for a wire it cannot read. Outbound, it throws, because a value your own code just produced and cannot describe is a bug in this tab, and finding it here beats finding it in someone else’s.

SchemaOptions.schema


optional snapshotDelayMs?: number;

Longest pause before answering a late joiner’s request for state, in ms. Default 40. The actual wait is random within it, so peers do not all answer at once and the first reply cancels the rest.


optional transport?: (name) => Transport;

Transport factory, mainly for tests. Defaults to defaultTransport.

ParameterType
namestring

Transport

CommonOptions.transport