Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 555 Bytes

cmux.md

File metadata and controls

21 lines (17 loc) · 555 Bytes

example

使用github.com/soheilhy/cmux 监听gRPC和http服务; http接口实现:调用gRPC接口。

code

  1. 运行服务
go run server.go
  1. gRPC调用
tg -c tgrpc.toml -C
  1. http调用
curl http://localhost:50052/api/helloworld.Greeter/SayHello -H 'customerId:123' -H 'region:UK' --data-binary '{"name":"gRPC&webapi"}' --compressed
curl http://localhost:2080/api/helloworld.Greeter/SayHello -H 'customerId:123' -H 'region:UK' --data-binary '{"name":"gRPC&webapi"}' --compressed