Skip to main content

Client-Server Document Synchronization

  • 2 minutes to read

The ASPxRichEdit control maintains the logical structure of a document in a document model. This model is sent to the client when the control loads a document. The model then exists on the client and server. The control synchronizes changes made on the client with the server.

Synchronization Process

Synchronization occurs every 5 seconds or instantly if the control executes an urgent command (for instance, the document is saved). During the pending period, the ASPxRichEdit control places non-urgent commands in a queue. The server can temporarily hold an outdated document model before the changes are synchronized (before the 5 seconds timeout is over).

During the synchronization process, the control sends a request with commands (maximum 250) to the server and waits for a response for up to 30 seconds.

  • If the control gets a response, the processed commands are removed from the queue and the control sends the next batch of commands.
  • If there is no response after 30 seconds, the control sends the request again.

Synchronization Properties

The requestSettings property allows you to change the default synchronization settings. The following properties are available:

Property Default Value Description
pendingPeriod 5 Specifies the pending period before the control sends a request to the server (in seconds).
maxCommandCount 250 Specifies the maximum number of commands that the control can send in one request.
responseWaitingTime 30 Specifies the time the control waits for a response before it sends a request again (in seconds).
richEdit.requestSettings.maxCommandCount = 100;
richEdit.requestSettings.responseWaitingTime = 10000;
richEdit.requestSettings.pendingPeriod = 3000;

Force the Synchronization

Execute the forceSyncWithServer command to force instant synchronization.

richEdit.commands.forceSyncWithServer.execute(function ()=> console.log("Models are equivalent"))