其实gRPC-Web 项目本身,就是为 JS/TS 提供 gRPC 能力的,让不支持 HTTP/2 的客户端和服务端也能使用 gRPC 的大部分特性。gRPC-Web 项目提供了一个 protoc CLI 插件,可用于把 proto 协议文件转换为 JS/TS 语言可导入的对应 gRPC 服务的客户端,还生成了 .d.ts 文件来支持 Typescript。 示例 接下来,我就...
datetimestamp 属性的类型 proto.google.protobuf.Timestamp 是protobuf 里的关键字,调用 toDate() 方法可转换为 TS 的 Date 类型。运行项目#完事具备,我们可以运行项目了。访问 https://localhost:5001/fetch-data,就可以看到前端是通过 gRPC-Web 获取数据了。总结...
其实gRPC-Web 项目本身,就是为 JS/TS 提供 gRPC 能力的,让不支持 HTTP/2 的客户端和服务端也能使用 gRPC 的大部分特性。gRPC-Web 项目提供了一个 protoc CLI 插件,可用于把 proto 协议文件转换为 JS/TS 语言可导入的对应 gRPC 服务的客户端,还生成了 .d.ts 文件来支持 Type。 示例 接下来,我就来展示...
在前端JS/TS调用ASP.NET Core gRPC-Web,实际上利用的是gRPC-Web项目提供的功能,该功能旨在为JavaScript/TypeScript提供gRPC能力,使得不支持HTTP/2的客户端和服务端也能使用gRPC的大部分特性。gRPC-Web项目提供了一个protoc CLI插件,能够将proto协议文件转换为JavaScript/TypeScript语言可导入的对应gRPC服...
gRPC 是一种与语言无关的高性能远程过程调用 (RPC) 框架。gRPC 的主要优点是:现代高性能轻量级 RPC ...
ts-protoc-gen - a TypeScript plugin for the protocol buffers compiler that provides strongly typed message classes and method definitions. @improbable-eng/grpc-web - a TypeScript gRPC-Web client library for browsers (and Node.js). Why? With gRPC-Web, it is extremely easy to build well-defi...
ts-protoc-gen can also generate gRPC service definitions with the service=true argument. Go to code generation docs Make a request using unary(), invoke() or client() import {grpc} from "grpc-web-client"; // Import code-generated data structures. import {BookService} from "./generated...
The --js_out plugin will generate JavaScript code (echo_pb.js), and the -grpc-web_out plugin will generate a TypeScript definition file for it (echo_pb.d.ts). This is a temporary hack until the --js_out supports TypeScript itself. For example, this is the command you should use ...
import_style=commonjs+dts: existing CommonJS style stub +.d.tstypings import_style=typescript: full TypeScript output import*asgrpcWebfrom'grpc-web';import{EchoServiceClient}from'./echo_grpc_web_pb';import{EchoRequest, EchoResponse}from'./echo_pb';constechoService =newEchoServiceClient('http...
Here are 188 public repositories matching this topic... Language:All Sort:Best match improbable-eng/grpc-web Star4.1k gRPC Web implementation for Golang and TypeScript golangtypescriptbrowsergrpcgrpc-web UpdatedNov 15, 2022 TypeScript stephenh/ts-proto ...