pull down to refresh

I've come across the SharedWorker docs a few times, hoping to find a problem that needed them. Back in 2022 I was thinking of using them to store a clientside nostr relay that would act like a cache (I think this is what most browser clients do now).
How are you doing master election?
105 sats \ 0 replies \ @rblb OP 13h
think this is what most browser clients do now
in my experience, current clients just spawn connections for each tab and they use some form of local storage for caching. Having a single shared worker that has one pool, one set of connections and persistent subscriptions would make them feel more like "normal" websites imo.
How are you doing master election?
very simple approach: each worker gets an id when it spawns, they periodically send heartbeat messages to each other via a BroadcastChannel. The active worker with lowest id becomes the master.
reply