API reference › @evolu/common › local‑first/Protocol › ApplyProtocolMessageAsRelayOptions

Defined in: packages/common/src/local-first/Protocol.ts:1335

Options for applyProtocolMessageAsRelay. The callbacks must not throw, because a throw is a defect that aborts the Run.

Properties

broadcast?

readonly optional broadcast?: (ownerId: string & Brand<"Id"> & Brand<"OwnerId">, message: ProtocolMessage) => void;

Defined in: packages/common/src/local-first/Protocol.ts:1343

To broadcast a protocol message to all subscribers.

rangesMaxSize?

readonly optional rangesMaxSize?: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"Between3000-100000">;

Defined in: packages/common/src/local-first/Protocol.ts:1352


subscribe?

readonly optional subscribe?: (ownerId: string & Brand<"Id"> & Brand<"OwnerId">) => void;

Defined in: packages/common/src/local-first/Protocol.ts:1337

To subscribe an owner for broadcasting.

totalMaxSize?

readonly optional totalMaxSize?: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"Between1000000-100000000">;

Defined in: packages/common/src/local-first/Protocol.ts:1350

The maximum size of the relay's responses and broadcasts, and of the requests it accepts. A larger request is a ProtocolInvalidDataError.


unsubscribe?

readonly optional unsubscribe?: (ownerId: string & Brand<"Id"> & Brand<"OwnerId">) => void;

Defined in: packages/common/src/local-first/Protocol.ts:1340

To unsubscribe an owner from broadcasting.