cosmjs
cosmjs copied to clipboard
Design best practices for reactive apps
Continuing a discussion from https://github.com/confio/cosmwasm-js/pull/99
@webmaster128 had concerns with the Stream interface we provide, both polling and websockets (with reconnect issues). These are important concerns as he has worked with said interface around a year at iov and has had many learnings.
That said, the entire design of "reactive frontend apps" is only getting bigger and bigger and I would like to work out some way to support that, even if it involved changes to a backend rpc server. Let us explore what other popular frameworks do and how they handle edge cases about breaking subscriptions, etc.
Some good examples:
Meteor
- First (popular) full-stack reactive framework. This controls client and server and pushes changes when they happen for fast updates.
- ServerConnections API
- How pubsub work (subscriptions)
- They use websockets, but I can't find docs on the internal
Apollo
- GraphQL queries
- Supports many frontend frameworks
- Nice discussion of subscriptions vs polling
- subscriptions-transport-ws is the transport layer that handles subscriptions
- But they have some issues around reconnect, look at this one in particular for a deeper analysis of their issues
I'd love to hear a deeper look into these protocols or other references. I don't think anyone has a perfect solution, but good to look how they tackle these problems (and maybe we can build on one?)