0

I have an angular application using gRPC API via gRPC-web. It is able to retrieve the data however the network tab shows it is using HTTP/1.1 protocol.

enter image description here

My understanding is that gRPC uses HTTP2 protocol for communication (which is faster than HTTP1) - Is this not the case?

I have added additional screenshots of response headers and payload for more information.

Payload: enter image description here

Header: enter image description here

Updating the question as requested:

gRPC.io website (https://grpc.io/blog/state-of-grpc-web/) has a diagram which shows that browser and gRPC-web can communicate via HTTP2. How can I change the angular code to use HTTP2?

developer
  • 1,401
  • 4
  • 28
  • 73
  • gRPC does use HTTP2 but you are using [gRPC-web](https://github.com/grpc/grpc-web), a related but different protocol, which does not require HTTP2 (this is really the reason it exists; the browser security model does not provide enough fine-grained control over the requests to use gRPC). See [this article](https://grpc.io/blog/state-of-grpc-web/) for further info, – Brits May 17 '22 at 15:59
  • Indeed, it answers my question. Thanks @Brits – developer May 18 '22 at 08:23
  • Is it fair to say gRPC-web may start supporting HTTP2 in future? – developer May 18 '22 at 11:36
  • gRPC-Web can run over HTTP2; I run a system which does this (backend written in go and using [improbable-eng](https://github.com/improbable-eng/grpc-web) package) but also found [this article](https://medium.com/@denis.zhbankov/grpc-web-via-http2-b05c8c8f9e6) ref envoy after a quick search. The issue is that the browser security model limits the amount of control your code has when establishing a connection (see [questions like this](https://stackoverflow.com/questions/52273174/how-to-implement-http-2-stream-connection-in-browser)). – Brits May 18 '22 at 13:44

0 Answers0