Skip to content

WebWorker setup

Volker Sorge edited this page Nov 20, 2024 · 2 revisions

For a general introduction see the WhatWG document.

Setup

sequenceDiagram

    Client Tab ->> Client Listener: Add `message` Listener for Iframe
    Client Tab ->> Iframe: Create
    Client Tab -->> Iframe: Add `src` with Server URL
    Server -->> Iframe: Pull `html`
    Server -->> Iframe: Pull `js` admin source
    Iframe ->> Iframe Client Listener: Add `message` Listener for Client Tab
    Iframe ->> Worker: Create
    Server -->> Worker: Pull `js` worker source
    Iframe ->> Iframe Worker Listener: Add `message` Listener for Worker
    Worker ->> Worker Listener: Add `message` Listener for Iframe
    Server -->> Worker: Import external `js` library (sync)

    Iframe -->> Client Listener: Post `Ready`
    Client Listener ->> Client Tab: set Iframe Window for posting

Loading

Communication

sequenceDiagram

    Client Tab ->> Iframe Client Listener: Post request to Iframe
    Iframe Client Listener -->> Iframe: Interpret and Execute request
    Iframe ->> Worker Listener: Post request
    Worker Listener -->> Worker: Interpret and Execute request
    Worker -->> Iframe Worker Listener: Post callback with result
    Iframe Worker Listener -->> Iframe: Interpret callback
    Iframe -->> Client Listener: Post callback with result
    Client Listener -->> Client Tab: Interpret reset and act
Loading