You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Collaborative Editing in ##Platform_Name## Document Editor Control | Syncfusion
4
+
component: DocumentEditor
5
+
description: Learn about collaborative editing in Syncfusion ##Platform_Name## Document editor control of Syncfusion Essential JS 2 and more.
6
+
publishingplatform: ##Platform_Name##
7
+
documentation: ug
8
+
domainurl: ##DomainURL##
9
+
---
10
+
11
+
# Collaborative Editing
12
+
13
+
Allows multiple users to work on the same document simultaneously. This can be done in real-time, so that collaborators can see the changes as they are made. Collaborative editing can be a great way to improve efficiency, as it allows team members to work together on a document without having to wait for others to finish their changes.
14
+
15
+
## Prerequisites
16
+
17
+
-*Real-time Transport Protocol*: This protocol facilitates instant communication between clients and the server, ensuring immediate updates during collaborative editing.
18
+
-*Distributed Cache or Database*: Used to temporarily store the queue of editing operations.
19
+
20
+
### Real time transport protocol
21
+
22
+
-*Managing Connections*: Keeps active connections open for real-time collaboration, allowing seamless communication between users and the server.
23
+
-*Broadcasting Changes*: Ensures that any edits made by one user are instantly sent to all collaborators, keeping everyone on the same page with the latest document version.
24
+
25
+
### Distributed cache or database
26
+
27
+
To support collaborative editing, it's crucial to have a backing system that temporarily stores the editing operations of all active users. There are two primary options:
28
+
29
+
-*Distributed Cache*: Handles a higher number of `HTTP` requests per second compared to a database approach. For instance, a server with 2 vCPUs and 8GB RAM can handle up to 125 requests per second using a distributed cache.
30
+
-*Database*: With the same server configuration, it can handle up to 50 requests per second.
31
+
32
+
Using the distributed cache or database all the editing operations are queued in order and conflict resolution is performed using `Operational Transformation` Algorithm.
33
+
34
+
> *Recommendation* - If you expect average `http` requests per second of your live application as 50 or below, then the database can provide reliable a backing system for operation queue. If you expect average requests per second of your live application as above 50, then the distributed cache is highly recommended backing system.
35
+
> Tips to calculate the average requests per second of your application:
36
+
Assume the editor in your live application is actively used by 1000 users and each user's edit can trigger 2 to 5 requests per second. The total requests per second of your applications will be around 2000 to 5000. In this case, you can finalize a configuration to support around 5000 average requests per second.
37
+
38
+
> Note: The above metrics are based solely on the collaborative editing module. Actual throughput may decrease depending on other server-side interactions, such as document importing, pasting formatted content, editing restrictions, and spell checking. Therefore, it is advisable to monitor your app's traffic and choose a configuration that best suits your needs.
39
+
#### See Also
40
+
41
+
-[Collaborative editing using Redis cache in ASP.NET Core](../../document-editor/collaborative-editing/using-distributed-cache-asp-net-core)
42
+
-[Collaborative editing using Microsoft SQL server in ASP.NET Core](../../document-editor/collaborative-editing/using-database-in-asp-net-core)
43
+
-[Collaborative editing using Java](../../document-editor/collaborative-editing/using-java)
title: Collaborative Editing in ##Platform_Name## Document Editor Control | Syncfusion
3
4
component: DocumentEditor
4
5
description: Learn how to enable and perform collaborative editing in Syncfusion ##Platform_Name## Document editor.
5
6
publishingplatform: ##Platform_Name##
7
+
documentation: ug
8
+
domainurl: ##DomainURL##
6
9
---
7
10
8
11
# Collaborative Editing
@@ -14,7 +17,64 @@ Allows multiple users to work on the same document simultaneously. This can be d
14
17
Following things are needed to enable collaborative editing in Document Editor
15
18
16
19
- SignalR
17
-
- Redis cache
20
+
- Redis
21
+
22
+
## SignalR
23
+
24
+
In collaborative editing, real-time communication is essential for users to see each other's changes instantly. We use a real-time transport protocol to efficiently send and receive data as edits occur. For this, we utilize SignalR, which supports real-time data exchange between the client and server. SignalR ensures that updates are transmitted immediately, allowing seamless collaboration by handling the complexities of connection management and offering reliable communication channels.
25
+
26
+
To make SignalR work in a distributed environment (with more than one server instance), it needs to be configured with either Azure SignalR Service or a Redis backplane.
27
+
28
+
### Scale-out SignalR using Azure SignalR service
29
+
30
+
Azure SignalR Service is a scalable, managed service for real-time communication in web applications. It enables real-time messaging between web clients (browsers) and your server-side application(across multiple servers).
31
+
32
+
Below is a code snippet to configure Azure SignalR in an ASP.NET Core application using the ```AddAzureSignalR``` method
Using a Redis backplane, you can achieve horizontal scaling of your SignalR application. The SignalR leverages Redis to efficiently broadcast messages across multiple servers. This allows your application to handle large user bases with minimal latency.
44
+
45
+
In the SignalR app, install the following NuGet package:
In collaborative editing, Redis is used to store temporary data that helps queue editing operations and resolve conflicts using the `Operational Transformation` algorithm.
67
+
68
+
All editing operations in collaborative editing are stored in the Redis cache. To prevent memory buildup, we can configure a `SaveThreshold` limit at the application level. If the `SaveThreshold` is 100, editing operations up to twice the save threshold limit are kept in Redis per document. Once exceeded, the first 100 operations (as defined by the save threshold) are removed from the cache and automatically saved to the source input document.
69
+
70
+
The configuration and store size of the Redis cache can be adjusted based on the following considerations.
71
+
72
+
-*Storage Requirements*: A minimum of 400KB of cache memory is needed for editing a single document, with the capacity to store up to 100 editing operations. Storage needs may increase based on following factor.
73
+
-*Images*: Increases with the number of images added to the document.
74
+
-*Pasted content*: Depends on the size of the SFDT content.
75
+
-*Connection Limits*: Redis has a limit on concurrent connections. Choose the Redis configuration based on your user base to ensure optimal performance.
76
+
77
+
> For better performance, we recommend to have minimum `SaveThreshold` limit of 100.
18
78
19
79
## How to enable collaborative editing in client side
@@ -219,8 +279,8 @@ Configure the Redis that stores temporary data for the collaborative editing ses
219
279
220
280
#### Import File
221
281
222
-
1. When opening a document, check the redis list for pending operations and get them for the collaborative editing session.
223
-
2. If the pending operations already exists, apply them to the WordDocument instance using the `UpdateActions` method before converting it to the SFDT format.
282
+
1. When opening a document, check the Redis cache for pending operations and retrieve them for the collaborative editing session.
283
+
2. If pending operations exist, apply them to the WordDocument instance using the `UpdateActions` method before converting it to the SFDT format.
224
284
225
285
```csharp
226
286
publicstringImportFile([FromBody] FileInfoparam)
@@ -246,23 +306,15 @@ public string ImportFile([FromBody] FileInfo param)
Each edit operation made by the user is sent to the server and pushed into a Redis list data structure. Each operation is assigned a version number upon insertion into Redis.
262
314
263
-
Each edit operation made by the user is sent to the server and is pushed into the redis list data structure. Each operation receives a version number after being inserted into the redis.
264
-
After inserting the records to the server, the position of the current editing operation must be transformed against any previous editing operations not yet synced with the client using the TransformOperation method.
265
-
After performing the transformation, the current operation is broadcast to all connected users within the group.
315
+
After inserting the records to the server, the position of the current editing operation must be transformed relative to any previous editing operations not yet synced with the client using the `TransformOperation` method to resolve any potential conflicts with the help of the `Operational Transformation` algorithm.
316
+
317
+
Once the conflict is resolved, the current operation is broadcast to all connected users within the group.
On the client side, messages broadcast using SignalR may be received in a different order, or some operations may be missed due to network issues. In these cases, we need a backup method to retrieve missing operations from the redis.
310
-
Using the following method, we can retrieve all operations after the last successful client-synced version and return all missing operations to the requesting client.
## How to perform Scaling in Collaborative Editing.
352
368
353
-
As the number of user increases, maintaining responsiveness and performance becomes challenging. Scaling tackles this by distributing the workload across resources. You can scale the collaborative editing application using either ```Azure SignalR service or Redis backplane service```
354
-
355
-
### 1. Scaling with Azure SignalR
356
-
357
-
Azure SignalR Service is a scalable, managed service for real-time communication in web applications. It enables real-time messaging between web clients (browsers) and your server-side application(across multiple servers).
358
-
359
-
Below is a code snippet to configure Azure SignalR in an ASP.NET Core application using the ```AddAzureSignalR``` method
Using a Redis backplane, you achieve horizontal scaling of your SignalR application. The SignalR leverages Redis to efficiently broadcast messages across multiple servers. This allows your application to handle large user bases with minimal latency.
371
-
372
-
In the SignalR app, install the following NuGet package:
#### Add Web API to get previous operation as a backup to get lost operations
374
370
375
-
Below is a code snippet to configure Redis backplane in an ASP.NET Core application using the ```AddStackExchangeRedis ``` method
371
+
On the client side, messages broadcast using SignalR might be received out of order or lost due to network issues. In such cases, we need a backup method to retrieve missing operations from Redis. By using the following method, we can retrieve all operations performed after the last successful client-synchronized version and return any missing operations to the requesting client.
0 commit comments