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

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

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

A relay built on it should also send the heartbeats that OwnerWebSocketTransport describes.

Properties

broadcast?

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

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

To broadcast a protocol message to all subscribers.


rangesMaxSize?

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

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


subscribe?

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

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

To subscribe an owner for broadcasting.


totalMaxSize?

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

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

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


unsubscribe?

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

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

To unsubscribe an owner from broadcasting.