Re: [ServiceWorker] Clients & postMessage (#609)

A client (C) is associated with zero or more `ServiceWorker` objects. A service worker (SW) is associated with zero or more `Client` objects. These are the entities that need to be able to communicate with each other.

I think we need to reconsider making these objects live (and therefore unique per global). When live message listeners could be registered at SW and C creation time and things would work. (This would mean SW is not always woken up by an event dispatched on the global.)

Making them live would require some kind of synchronization event when a new C or SW presents itself to the other side. It would also mean that any state on `Client` and `ServiceWorker` objects should probably be behind promises if it can easily change.

User agents can still optimize by creating these collections lazily when they are accessed (or assumed to be accessed based on experience running the code).

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/609#issuecomment-74100580

Received on Thursday, 12 February 2015 16:24:19 UTC