learningequality / learningequality/studio

Minimize use of websocket connections from the frontend

Open
#4,160 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DEV: frontend P2 - normal
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:

  1. 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.
  2. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.