loader
loader copied to clipboard
[WIP] MessageBus proposal
Hey, here's a proposal for MessageBus. It consists of 2 sides - Provider (loader) and Consumer (iframe). When first initiating the app, it's the Consumer that plays the active role, pushing it's MessageChannel to the Provider, since Consumer is more aware of when it's ready to initiate the communications. When setting up the bus, you can send (schedule) messages right away - they'll be queued and sent what both sides finish the handshake and acknowledge their readiness for receiving the messages.
From the user perspective you can use one of 2 approaches:
- Listen to messages as they come (async) and optionally react to them (for example send some msg back)
- Use Requests which hide the subscription logic by rewriting actions/messages and wrapping this into Promise based API. This will come in handy when dealing with simple request-response model (eg. querying for some specific information).
Looking forward to your comments. In the meantime I'll be working on remaining features / edge-cases and writing tests.