Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@anulman
Copy link
Contributor

@anulman anulman commented May 30, 2025

I was trying to use rimless to connect to a SharedWorker, which has different listenTo and sendTo semantics:

// in window
async function connect() {
  const worker = new SharedWorker(...);
  const connectionPromise = host.connect(worker, { ... });

  worker.port.start();
  return await connectionPromise;
}
// in worker
const connections = [];

self.addEventListener("connect", (event) => {
  const port = event.ports[0];
  const connectionPromise = guest.connect({ ... }, { hostTarget: port });

  port.start();
  connections.push(await connectionPromise);
});

@anulman anulman force-pushed the upstream/support-sharedworker branch from 9d4f65c to 31b5f07 Compare June 6, 2025 02:59
@anulman anulman force-pushed the upstream/support-sharedworker branch from 31b5f07 to c723192 Compare June 6, 2025 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant