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

function createProtocolMessageBuffer(
  ownerId: string & Brand<"Id"> & Brand<"OwnerId">,
  options: {
    rangesMaxSize?: number &
      Brand<"NonNaN"> &
      Brand<"Finite"> &
      Brand<"Int"> &
      Brand<"Between3000-100000">;
    totalMaxSize?: number &
      Brand<"NonNaN"> &
      Brand<"Finite"> &
      Brand<"Int"> &
      Brand<"Between1000000-100000000">;
    version?: number &
      Brand<"NonNaN"> &
      Brand<"Finite"> &
      Brand<"Int"> &
      Brand<"NonNegative">;
  } & (
    | {
        messageType: 0;
        subscriptionFlag?: SubscriptionFlag | undefined;
        writeKey?: Uint8Array<ArrayBufferLike> &
          Brand<"Entropy"> &
          Brand<"Length16"> &
          Brand<"OwnerWriteKey">;
      }
    | {
        errorCode: ProtocolErrorCode;
        messageType: 1;
      }
    | {
        messageType: 2;
      }
  ),
): ProtocolMessageBuffer;

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