+1
日增长
9,260
stars
794
forks
188
watchers
730
prs
776
issues
25
releases
README
gRPC Web ·
A JavaScript implementation of [gRPC][] for browser clients. For more information,
including a quick start, see the [gRPC-web documentation][grpc-web-docs].
gRPC-web clients connect to gRPC services via a special proxy; by default,
gRPC-web uses [Envoy][].
In the future, we expect gRPC-web to be supported in language-specific web
frameworks for languages such as Python, Java, and Node. For details, see the
roadmap.
Streaming Support
gRPC-web currently supports 2 RPC modes:
- Unary RPCs (example)
- Server-side Streaming RPCs (example) (NOTE: Only when grpcwebtext mode is used.)
Client-side and Bi-directional streaming is not currently supported (see streaming roadmap).
Quick Start
Eager to get started? Try the [Hello World example][]. From this example, you'll
learn how to do the following:
- Define your service using protocol buffers
- Implement a simple gRPC Service using Node.js
- Configure the Envoy proxy
- Generate protobuf message classes and client service stub for the client
- Compile all the JS dependencies into a static library that can be consumed
by the browser easily
Advanced Demo: Browser Echo App
You can also try to run a more advanced Echo app from the browser with a
streaming example.
From the repo root directory:
sh
$ docker-compose pull prereqs node-server envoy commonjs-client
$ docker-compose up node-server envoy commonjs-client
Open a browser tab, and visit http://localhost:8081/echotest.html.
To shutdown: docker-compose down.
Runtime Library
The gRPC-web runtime library is available on npm:
sh
$ npm i grpc-web
Code Generator Plugins
(Prerequisite) 1. Protobuf (protoc)
If you don't already have protoc
installed, download it first from here and install it on your PATH.
If you use Homebrew (on macOS), you could run:
sh
brew install protobuf
(Prerequisite) 2. Protobuf-javascript (protoc-gen-js)
If you don't have protoc-gen-js installed, download it from protocolbuffers/protobuf-javascript and install it on your PATH.
Or, use the third-party npm installer:
npm install -g protoc-gen-js
3. Install gRPC-Web Code Generator
You can download the protoc-gen-grpc-web protoc plugin from our
release page:
Make sure all executables are discoverable from your PATH.
For example, on macOS, you can do:
sh
sudo mv protoc-gen-grpc-web-2.0.2-darwin-aarch64 \
/usr/local/bin/protoc-gen-grpc-web
chmod +x /usr/local/bin/protoc-gen-grpc-web
Note: If you are using our Docker setup, the prereqs image already includes
both protoc and the protoc-gen-grpc-web plugin on the PATH.
(Optional) 4. Verify Installations
You can optionally verify the plugins work by following our Hello World example:
sh
cd net/grpc/gateway/examples/helloworld
protoc -I=. helloworld.proto \
--js_out=import_style=commonjs:. \
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:.
After the command runs successfully, you should now see two new files generated
in the current directory. By running:Top issues
#399Decoding grpc-status-details-bin ?34 comments · 2018-11-30#535ES Modules Support?29 comments · 2019-04-12#522Is there any way to circumvent the browsers limitations for concurrent connections http228 comments · 2019-04-03#90react native support?28 comments · 2017-04-06#447Failed to compile. 'proto' is not defined (also 'COMPILED')20 comments · 2019-01-30#557How to disable Stream timeout19 comments · 2019-05-10#338docs: security19 comments · 2018-10-24#1414Closure Migration & Typescript-ification18 comments · 2024-03-19
Discussions
#1531Project status following June 2025 roadmap update1 comments · 2026-04-21#1520What is the best way to handle errors in gRPC-Web?0 comments · 2026-01-16#1513Streaming support over HTTP3/QUIC1 comments · 2025-10-01#1480Received RpcError is always code 2: Incomplete response2 comments · 2025-04-06#1476callback in `on(eventType: "data", callback)` of `ClientReadableStream` won't be not called1 comments · 2025-01-29#1469Events not received when using server-side streaming RPC with React Native for Windows (with mode=grpcwebtext)3 comments · 2024-10-09#1467is grpc-web compatible with vue or nuxt ?0 comments · 2024-09-30#1459How to add options to the client1 comments · 2024-08-19
Latest release
Release 2.1.1 2.1.1 2026-08-27This is the 2.1.1 release of gRPC-Web! :) Please see the notes for the previous releases here. Please consult grpc.io for all information regarding this product. This release contains improvements and bug fixes listed below. Security - 1547 limit maxReceiveMessageSize to 4MB to have parity with other runtimes @mbissa Other Changes - 1548 fix(docker): resolve grpcwebproxy build failure caused by dead vanity ... @Vuhag123 - 1545 chore: upgrade macOS CI to macos-14 and prune unused rollup-plugin-cop... @Vuhag123 Full Changelog: https://github.com/grpc/grpc-web/compare/2.1