Why gRPC is not the best tool for browsers
The key reason why gRPC is not the best tool for browsers is that it relies on HTTP/2. While modern browsers support HTTP/2, they don't support all of its features, but some of those unsupported features are precisely the features that gRPC needs.
To work around these limitations, a browser-specific implementation has been developed. This is known as gRPC-Web.
However, even this implementation is not perfect. It comes with the following limitations that, arguably, nullify the utility of gRPC:
- It requires a proxy to run between the client and the server, converting browser-bound data into a format compatible with HTTP/1.1, increasing the latency and making the payload larger.
- It does not support client-streaming calls.
- It requires relaxing cross-origin resource sharing (CORS) policy on the server side, potentially creating security vulnerabilities.
- Both the client and the server require additional setup steps...