Handling multiple clients connected to the same workspace #1472
-
Hi, I've been developing an application using your framework for the last 6-8 months. Currently, I'm working on a challenging feature involving multiple clients connected to the same workspace. I'm using a Node.js and Theia-based template, and I'm storing the model in a JSON-like file. The server handles connections correctly, but the diagrams on two different clients (working on the same file) become inconsistent when both users try to modify the diagram at the same time. I've been looking for resources on this topic, but most of the information I've found is from 3-4 years ago and may be outdated. Can anyone provide any guidance, tips, or examples on how to effectively handle this situation? Thanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thanks for reaching out and for using Eclipse GLSP in your project! You're right that handling multiple clients modifying the same diagram in real time can be challenging. By default, a GLSP server can manage multiple clients, but it doesn't automatically synchronize their model states. To enable real-time collaboration (similar to Google Docs), you need additional logic to share the model state and propagate updates to all connected users, potentially share additional meta information such as the current selection state, etc. Also managing separate command stacks is something you typically want to take care of, to avoid weird states when one user uses undo, after another user made a change. From our experience in customer projects, we found that this requirement is best handled at the tool integration level (e.g., Theia or VS Code) rather than within GLSP itself. Typically, collaboration spans the entire tool, not just the diagram editor. That’s why we integrated GLSP with external collaboration services like VS Code LiveShare instead of implementing synchronization purely within GLSP. Together with Markus (a former student at TU Wien), we explored this in more depth and developed a generalization of a VS Code LiveShare integration. You might find our blog post useful: Unfortunately, this work hasn't been integrated into the GLSP core yet, but we're currently working with another student to advance it. For your case with Theia, VS Code LiveShare won't be an option, but you could look into the Open Collaboration Tools initiative, which also provides the necessary extensibility to integrate with GLSP, and there is an existing Theia integration available. If you're interested in contributing to this effort and we'd be happy to connect you with the ongoing work in this area. |
Beta Was this translation helpful? Give feedback.
Thanks for reaching out and for using Eclipse GLSP in your project!
You're right that handling multiple clients modifying the same diagram in real time can be challenging. By default, a GLSP server can manage multiple clients, but it doesn't automatically synchronize their model states. To enable real-time collaboration (similar to Google Docs), you need additional logic to share the model state and propagate updates to all connected users, potentially share additional meta information such as the current selection state, etc. Also managing separate command stacks is something you typically want to take care of, to avoid weird states when one user uses undo, after another user made a change.