iroha-javascript
iroha-javascript copied to clipboard
Make client transport-agnostic
Using some concrete HTTP and WebSocket client limits some usage possibilities.
For HTTP client uses native Fetch API in browser and node-fetch in node. It is quite lightweight, but it has a set of drawbacks:
- To put some custom header, client should expose a separate API for it
- To use some advanced fetch api like request abortion, client should expose a separate API for it
And this list can go on and on. It is not a nice decision to handle each possible API extension by extending the client (i.e. iroha client) itself. It would be much nicer if client provides a toolchain to build requests and to handle responses for them.
For WebSocket client currently uses the same approach - native WebSocket in browser, and ws in node. It has the same set of drawbacks. And it can be solved in the same way.