ot-0.1.1.1: Real-time collaborative editing with Operational Transformation

Safe HaskellSafe-Inferred

Control.OperationalTransformation.Client

Synopsis

Documentation

data ClientState op Source

At every moment, the client is in one of three states.

Constructors

ClientSynchronized

All of the client's operations have been acknowledged by the server.

ClientWaiting op

The client has sent an operation to the server and it is still waiting for an acknowledgement.

ClientWaitingWithBuffer op op

The client is waiting for an acknowledgement for a pending operation and the client is buffering local changes.

Instances

Eq op => Eq (ClientState op) 
Read op => Read (ClientState op) 
Show op => Show (ClientState op) 

initialClientState :: ClientState opSource

The state a newly connected client starts in (synonym for ClientSynchronized).

applyClientSource

Arguments

:: OTComposableOperation op 
=> ClientState op 
-> op

The operation the user has performed on the local document.

-> Either String (Bool, ClientState op)

Whether to send the operation to the server and the new client state (or an error).

Handle user-generated operations.

applyServerSource

Arguments

:: OTComposableOperation op 
=> ClientState op 
-> op 
-> Either String (op, ClientState op)

The transformed operation that must be applied to local document and the new state (or an error).

Handle incoming operations from the server.

serverAckSource

Arguments

:: ClientState op 
-> Maybe (Maybe op, ClientState op)

An optional operation that must be sent to the server if present and the new state.

Handle acknowledgements.