CoinAlpha / gateway-api

Apache License 2.0
47 stars 25 forks source link

Decide if we should use REST or WebSocket #79

Closed james-hummingbot closed 3 years ago

james-hummingbot commented 3 years ago

https://www.notion.so/hummingbot/Gateway-architecture-redesign-e768c4208207497cbbb9be035ae9b4da

There are performances advantages to using websocket, but also some concerns about having to rewrite the way hummingbot client interacts with gateway and how to handle dropped sockets. We also want to make sure all the chains we support can also use websockets to interact with them or we don't gain much with this (so far we know you can use websocket with infura and Ethereum).

james-hummingbot commented 3 years ago

@mifeng @Nullably and I discussed this today. He had a few concerns in regards to dropped sockets and keeping track of lost data. Other than that I could only find WebSocket libraries for Ethereum and Binance. I didn't see anything for xDai or Optimism. I think there is already enough to say it isn't supported by enough block chains we are interested. Another concern is that if we only provide WebSocket connections to gateway API, it makes it harder to use, it also forces you to depend services that support websocket (users might want to use other things).

I think for now it makes sense to stick with REST. In the future we could consider a hybrid approach, choice of websockets for chains that support and users that want it, if not use REST, but the scope of this epic is already quite large so I think we revisit this later.