Client
Client that can communicate with the server. It has Documents and sends changes of the documents in local to the server to synchronize with other replicas in remote.
A single-threaded, Closeable is used as default. Therefore you need to close the client, when the client is no longer needed. If you provide your own dispatcher, it is up to you to decide close is needed or not.
Constructors
Types
ClientCondition represents the condition of the client.
DeactivateOptions are user-settable options used when deactivating clients.
User-settable options used when defining Client.
SyncMode defines synchronization modes for the PushPullChanges API.
Properties
The stable actor stamped into this client's document changes, or null while deactivated. Equal to requireClientId against a pre-0.7.20 server, which never sends actor_id.
Functions
Activates this Client. That is, it registers itself to the server and receives a unique ID from the server. The given ID is used to distinguish different clients.
attachChannel attaches the given channel counter to this client. It registers the channel locally; the server is notified by the first RefreshChannel heartbeat, which creates the session and — for a client that never called activateAsync — activates the client lazily.
Attaches the given Document to this Client. It tells the server that this Client will synchronize the given document.
Changes the sync mode of the document.
Closes this Client locally: releases its dispatcher and HTTP resources. This is an abrupt teardown — it sends no detach/deactivate RPC and releases no session lease. detachDocument/deactivateAsync before close remains the durable, server-acked path.
Creates a revision snapshot for the given document with the given label and optional description. The document must be attached to this client.
Deactivates this Client.
detachChannel detaches the given channel counter from this client. Cleanup is local-only: heartbeats stop and the server reclaims the session via TTL. No RPC is sent.
Retrieves the revision identified by revisionId for the given document, including its full snapshot. The document must be attached to this client.
Lists revisions for the given document. The document must be attached.
peekChannel reads the current session count of a channel without creating a session on the server. Use this when the caller only needs to display the count (e.g. "N people writing") without contributing to it and without receiving broadcasts.
Removes the given document.
Returns the stable actor stamped into this client's document changes, throwing if the client is not active. See actorId.
Restores the given document to the state captured by the revision with revisionId. The document must be attached to this client.
Recovers document in place after the server has refused to accept its local writes (D3; JS SDK client.ts resync, 61ca06c9/#1463): discards its un-pushed local changes, detaches without clearing presence, then re-attaches it under the SAME sync mode, disableGC, presence, and schema it had -- the same Document instance, never swapped for a new one. Restarts the sync loop if it had stopped.
Pushes local changes of the attached documents to the server and receives changes of the remote replica from the server then apply them to local documents.