How to bring a gRPC defined API to the web browser

前端 未结 8 766
孤街浪徒
孤街浪徒 2021-01-29 22:39

We want to build a Javascript/HTML gui for our gRPC-microservices. Since gRPC is not supported on the browser side, we thought of using web-sockets to connect to a node.js serve

8条回答
  •  太阳男子
    2021-01-29 23:25

    Unfortunately, there isn't any good answer for you yet.

    Supporting streaming RPCs from the browser fully requires HTTP2 trailers to be supported by the browsers, and at the time of the writing of this answer, they aren't.

    See this issue for the discussion on the topic.

    Otherwise, yes, you'd require a full translation system between WebSockets and gRPC. Maybe getting inspiration from grpc-gateway could be the start of such a project, but that's still a very long shot.

提交回复
热议问题