Woah! This is exactly what I was thinking, a relay in a browser tab. Can you point to some code I can check out?
Websocket proxy to local relay https://github.com/nostrband/nostr-universe/blob/main/app/src/modules/relay-proxy.ts
Websocket proxy talks to the relay running in a worker using comlink lib which is part of the framework we used, but that's just a wrapper for postMessage
Dumb relay https://github.com/nostrband/nostr-universe/blob/main/app/src/modules/relay.ts
Thank you!