为什么浏览器不支持gRPC? [英] Why do browsers not support gRPC?

查看:553
本文介绍了为什么浏览器不支持gRPC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gRPC基于HTTP/2,它(假设)已被浏览器广泛支持.因此,我觉得浏览器中的gRPC应该没有问题.

gRPC is based on HTTP/2, which (assumption) is widely supported by browsers. Therefore, I feel there should be no problem with gRPC from a browser.

但是,很明显这是有问题的.协议 grpc网站是不同的,因为存在由于浏览器限制".还有许多博客文章描述了部署复杂的技术堆栈,以使gRPC在浏览器中正常工作.

However, it is clear that there is a problem. The protocol, grpc web, is different, as exists "due to browser limitation". There are also numerous blog post describing complicated tech stacks deployed to get gRPC to work from a browser.

我错过了实际的问题-为什么gRPC不能仅在浏览器中工作?

I'm missing the actual problem - why does gRPC not simply work from browsers?

推荐答案

我现在了解到,浏览器仅支持HTTP/2,因为它们使用HTTP/2代表您的应用程序(javascript)代码从服务器获取资源.

I now understand that browsers only supports HTTP/2 in the sense that they use it to fetch resources from the server on behalf of your application (javascript) code.

Javascipt应用程序代码仍只能使用HTTP/1(浏览器可以通过HTTP/2连接在后台进行处理).因此,应用程序代码无法使用grpc.

Javascipt application code can still only use HTTP/1 (which may be handled under the hood by the browser in an HTTP/2 connection). Therefore it is not possible for application code to use grpc.

如果任何人都可以找到文档中解释的地方,那么最好在此处添加链接.

If anyone should find where this is explained in the docs, it would be good to add a link to it here.

这篇关于为什么浏览器不支持gRPC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆