Create a client
MeridianClient.create() parses and validates the token before opening the WebSocket. It returns an Effect.
Config
| Option | Type | Default | Description |
|---|---|---|---|
url | string | — | Server base URL (http:// or ws://, both work) |
namespace | string | — | Namespace to connect to |
token | string | — | Meridian token |
autoConnect | boolean | true | Open WebSocket immediately |
offline | boolean | false | Never auto-connect — work from local cache, call connect() manually |
persistence | PersistenceConfig | — | Opt-in local persistence — see Offline-first |
Properties
CRDT handles
All handles are cached bycrdtId — calling the same method twice returns the same instance.
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:
curl call and full field reference.
Wait for connection
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.Op latency
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.