feat: replace js grpc gateway with envoy
Closed this issue · 3 comments
currently we use nodejs grpc gateway to convert between grpc and json.
https://github.com/Fluidex/grpc-dynamic-gateway
we plan to use envoy to replace it.
TODOs:
add envoy config, add envoy into docker compose file, remove old grpc gatewat in docker compose, etc.
Our CI tests grpc gateway actually
This script makes requests to gateway and gets responses. https://github.com/Fluidex/dingir-exchange/blob/fc91b589700ab03f27a897afa051b39f2abc71ba/examples/js/print_orders.ts#L19
So you shouldn't break this test.
materials that may be useful:
https://www.aapelivuorinen.com/blog/2020/08/01/envoy-json-grpc-transcoding/
https://github.com/tetratelabs/istio-tools/tree/master/grpc-transcoder
it supports streaming too : https://github.com/grpc/grpc-web
but uses long polling
Currently the gRPC-Web client library uses XHR to ensure cross-browser support and to support platforms such as React-Native.
We do plan to add fetch/streams support at some point, which is more efficient for binary streams and incurs less memory overhead on the client-side.
However, fetch still has certain gaps compared to XHR, most notably the lack of cancellation support. Progressing events, I/O event throttling are other concerns.
envoy can also serve static files: https://jteso.github.io/envoy/documentation/site/modules/static/