在没有 NodeJS 的情况下使用 GRPC-Web

问题描述

如何在浏览器上使用 GRPC-Web? 我的意思是,在纯浏览器代码中,不涉及任何 NodeJS。

来自此处的官方示例:https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld 主要面向 NodeJS。

有没有办法以纯 Javascript 形式使用 GRPC-Web,而无需:

const {HelloRequest,HelloReply} = require('./helloworld_pb.js');
const {GreeterClient} = require('./helloworld_grpc_web_pb.js');

意思是,只是标准的 <script> 添加 Javascript 依赖项的方式? 并且能够做到:var client = new GreeterClient('http://localhost:8080');

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)