learningequality / learningequality/studio
Minimize use of websocket connections from the frontend
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 191
- Forks
- 307
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
Background / Context
We need to optimize how changes get synced from the frontend to the backend in multi-tab scenarios.
Current behavior
Each tab in which a Studio channel is open, creates its own websocket connection with the backend. This includes tabs that have the same channel open, meaning the frontend would receive duplicate change objects from the backend.
Desired behavior
There are a few different approaches, the following are two:
- Move change syncing and websocket connections to a service worker, and have each tab send messages to the worker which synchronizes them to the backend. Since the service worker would be controlling the websocket connections for each open channel, it could de-duplicate multiple connections.
- Simply use a service worker to relay changes from one tab to another where the websocket connection is open. This is similar to how we initially had the sync polling, but could be problematic because of the browser's timer throttling or memory saver.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by mapping how each Studio tab creates its websocket connection and how changes are synchronized between the frontend and backend in multi-tab scenarios. Compare the service-worker approaches described in the issue, including their behavior under browser timer throttling and memory-saving; done means an agreed design that avoids duplicate connections or change objects.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100