-
Notifications
You must be signed in to change notification settings - Fork 32
✨ [Frontend] Feature: sync with projectDocument:updated WS
#8165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ [Frontend] Feature: sync with projectDocument:updated WS
#8165
Conversation
…parc-simcore into feature/event-driven-patches
…parc-simcore into feature/event-driven-patches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the first iteration of WebSocket synchronization for projectDocument:updated events to enable real-time collaboration features. The implementation allows multiple clients to synchronize pipeline changes through WebSocket broadcasts, with conflict detection and automatic patch application.
- Adds WebSocket listener for
projectDocument:updatedevents with conflict detection via client session ID - Implements JSON patch-based synchronization using upgraded jsondiffpatch library (v0.7.3)
- Adds support for real-time UI updates including node positions, annotations, and edges
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| JsonDiffPatch.js | Upgrades library to v0.7.3 and adds delta-to-JSON patch conversion |
| StudyEditor.js | Implements WebSocket project document synchronization and patch application |
| Workbench.js | Adds support for updating workbench from JSON patches |
| StudyUI.js | Implements UI patch handling for annotations and node UI changes |
| Study.js | Adds study-level patch handling methods |
| Node.js | Adds node-level patch application and position change events |
| WorkbenchUI.js | Adds edge creation/removal event handling and annotation listeners |
| NodeUI.js | Adds position change listener for real-time updates |
| Resource.js | Adds client session ID to HTTP headers |
| Various other files | Minor fixes and improvements for robustness |
services/static-webserver/client/source/class/osparc/wrapper/JsonDiffPatch.js
Show resolved
Hide resolved
services/static-webserver/client/source/class/osparc/data/model/Workbench.js
Show resolved
Hide resolved
services/static-webserver/client/source/class/osparc/data/model/StudyUI.js
Show resolved
Hide resolved
services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js
Outdated
Show resolved
Hide resolved
matusdrobuliak66
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪
What does this refer to? From what I've seen in a PR from @matusdrobuliak66 this should not be possible. Can you please clarify this part |
In our case, avoiding an echo loop means preventing client B from re-sending to the backend the changes it just applied from client A, since the backend already has those. There are more ways to avoid this useless patches, but with the current approach of the frontend not sending granular patches and the backend broadcasting the entire project document, I find this is the safest solution. |
|
Think I got it, the backend keeps track of the latest version, but nothing stops the frontend from sending the same data as a new update, which could even be a legitimate use case. |
GitHK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, and I've noticed how you "cheated" with the jupyter!
sanderegg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!



What do these changes do?
This PR implements the 1st iteration on the WebSocket synchronization for the
projectDocument:updatedevent to enable Real Time Collaboration features.Notes:
projectDocument:updatedand frontend's project, both objects need to be curatedMissing actions to sync, in order to avoid corrupted studies, userB will be logged out.
inputsRequiredBonus:
Study changes:

Workbench changes and Run pipeline:

Dynamic service:

Study UI changes:

Related issue/s
How to test
Dev-ops