command
Version:
v2.3.0
Opens a new window with list of versions in this module.
Published: Sep 29, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 20
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Gateway Multi-Protocol Example
同一套 gRPC handler,同时暴露:
| 端口 |
前端 |
:8080 |
HTTP/REST + gRPC-Web(Fiber) |
:8081 |
WebSocket(net/http) |
:50051 |
Native gRPC |
演示本轮契约:
gatewayserver.NewGatewaySurface 装配入口
Mux.UseRPCMiddleware(响应头 X-Example-Mw)
- gRPC-Web 成功 trailer / gzip 压缩协商
- HTTP 拒绝 client/bidi(
/v1/greeter/chat → Unimplemented)
Run
go run ./internal/examples/grpcwebsocket
浏览器:http://localhost:8080/
Verify
# 另开终端
go run ./internal/examples/grpcwebsocket/verify/
覆盖:HTTP/JSON、HTTP client-stream 拒绝、gRPC-Web unary/gzip/server-stream、WS 四流、native gRPC。
- JS SDK(HTTP/JSON + gRPC-Web):
sdk/js/gateway-client(@pubgo/lava-gateway-client)
- HTTP/gRPC-Web 精简示例:
internal/examples/grpcweb(前端消费 SDK)
- 设计文档:
pkg/gateway/docs/design-evolution.md
Documentation
¶
Package main 提供 Gateway 多协议示例:同一套 gRPC handler 同时暴露
HTTP/REST + gRPC-Web、WebSocket、Native gRPC。
运行:
go run ./internal/examples/grpcwebsocket
验证(需先启动本服务):
go run ./internal/examples/grpcwebsocket/verify/
Source Files
¶
Directories
¶
Command verify exercises every gateway frontend exposed by the grpcwebsocket example.
|
Command verify exercises every gateway frontend exposed by the grpcwebsocket example. |
Click to show internal directories.
Click to hide internal directories.