Skip to main content

Create a client

MeridianClient.create() parses and validates the token before opening the WebSocket. It returns an Effect.

Config

Properties

CRDT handles

All handles are cached by crdtId — calling the same method twice returns the same instance.
For orset, lwwregister, presence, and awareness, passing an Effect Schema enables runtime validation of incoming payloads. Without a schema, T = unknown. awareness handles are keyed by a logical channel name (e.g. "cursors", "selection:doc-1") rather than a CRDT id — they are ephemeral and not persisted. See Awareness.

HTTP client

Issuing tokens

issueToken accepts both V1 (glob lists) and V2 (fine-grained rules):

Inspecting the current token

tokenMe decodes and returns the claims of the caller’s own token — useful for debugging without msgpack tooling:
See Tokens for the equivalent curl call and full field reference.

Wait for connection

Resolves when the WebSocket reaches CONNECTED state. Useful in tests or when you need to send an operation immediately after creating the client (before the connection handshake completes). Throws Error: WsTransport: connect timeout if the timeout elapses.

Offline queue

Operations sent while disconnected are buffered automatically and flushed in order on reconnect — no configuration needed.
The queue holds up to 500 ops. If the limit is reached, the oldest op is dropped to make room.

Op latency

Returns P50 and P99 round-trip latency in milliseconds from the last 128 acknowledged ops, or null if fewer than 2 samples have been collected. Latency is measured from send to server Ack receipt — no clock synchronisation required. The meridian-devtools panel displays this automatically in the Connection section.

Close