A collaborative real-time text editor is an application that allows multiple users to edit a document simultaneously and merge their contributions automatically. It can be made collaborative by implementing a conflict resolution algorithm either on the client side (in peer-to-peer collaboration) or on the server side (when using web sockets and a central server to monitor state changes). Although web sockets are ideal for real-time text editors, using multiple collaborative editors on one connection can create problems. This is because a single web connection cannot monitor which user is collaborating on which application state, leading to unnecessary network queries and data being delivered to the wrong state. To address this issue, the current solution is to open multiple web socket connections, with one web socket per collaboration application. However, this can add significant overhead proportional to the number of apps utilized. In this study, we demonstrate an algorithm that enables using a single web socket for multiple collaborative applications in a collaborative editor. Our method involves modifying the socket's code to track which application's shared state is being worked on and by whom. This allows for the simultaneous collaboration of multiple states in real-time, with infinite users, without opening a different socket for each application. Our optimized editor showed an efficiency improvement of over 96% in access time duration. This approach can be implemented in other collaborative editors and web applications with similar architecture to improve performance and eliminate issues arising from network overload.
翻译:协同实时文本编辑器是一种允许多个用户同时编辑文档并自动合并其贡献的应用程序。通过实现冲突解决算法,可以在客户端(点对点协作)或服务器端(使用WebSocket和中央服务器监控状态变化)实现协同编辑功能。尽管WebSocket是实时文本编辑器的理想选择,但在单一连接上使用多个协同编辑器可能引发问题。这是因为单个Web连接无法监控哪个用户正在操作哪个应用程序状态,从而导致不必要的网络查询及数据被传递至错误状态。为解决此问题,当前解决方案是为每个协同应用开启独立的WebSocket连接,但这会带来与应用程序数量成正比的显著开销。本研究提出一种算法,使得协同编辑器中多个协同应用可共享单一WebSocket连接。我们的方法通过修改套接字代码来追踪特定应用共享状态的操作者及操作对象,从而实现多状态实时协同编辑(支持无限用户)而无需为每个应用开启独立套接字。经测试,优化后的编辑器在访问时间效率上提升超过96%。该方法可推广至其他具有类似架构的协同编辑器及网络应用,以提升性能并消除网络过载引发的问题。