trpc-group / trpc-go

A pluggable, high-performance RPC framework written in golang
Other
742 stars 85 forks source link

trpc-go doesn't support gRPC protocol? #139

Closed zanlichard closed 7 months ago

zanlichard commented 7 months ago

Preliminary Research

Question

Additional Information

WineChord commented 7 months ago

https://github.com/trpc-ecosystem/go-codec/tree/main/grpc

zanlichard commented 7 months ago

if the protocol config option in trpc_go.yaml config use http and proto definition by protobuf,it means client access server by gRPC?

WineChord commented 7 months ago

No, it is actually HTTP-RPC, refer to: https://github.com/trpc-group/trpc-go/tree/main/http

image

zanlichard commented 7 months ago

if we use rpc over http, what's the format of the url path client accessing service ?

zanlichard commented 7 months ago

trpc-go integrete grpc by codec in trpc-ecosystem,how to modify main.go? like this _ "trpc.group/trpc-go/trpc-codec/grpc" in main.go?

WineChord commented 7 months ago

if we use rpc over http, what's the format of the url path client accessing service ?

https://github.com/trpc-group/trpc-go/tree/main/http#custom-url-path

Something like http://ip:port/trpc.app.server.Greeter/SayHello.

WineChord commented 7 months ago

trpc-go integrete grpc by codec in trpc-ecosystem,how to modify main.go? like this _ "trpc.group/trpc-go/trpc-codec/grpc" in main.go?

You may check the examples: https://github.com/trpc-ecosystem/go-codec/blob/main/grpc/examples/clients/grpc/main.go

zanlichard commented 7 months ago
  1. register under base layer import "trpc.group/trpc-go/trpc-go/codec" codec.Register("grpc", &serverCodec{}, &clientCodec{})

  2. register implicitly add code into main.go as below import _ "trpc.group/trpc-go/trpc-codec/grpc"

  1. register explicitly add code into main.go,as below import "trpc.group/trpc-go/trpc-codec/grpc" s := trpc.NewServer(server.WithStreamTransport(grpc.DefaultServerStreamTransport))
zanlichard commented 7 months ago

what's the difference between gRPC and tgprc?

WineChord commented 7 months ago

The tRPC framework itself is an extremely flexible and plugin-based structure. tgrpc is the result of integrating the server/client capabilities of gRPC into the tRPC framework. By using tgrpc, you can leverage various plugin capabilities of tRPC server/client while also interacting with other gRPC server/clients.

ninesunqian commented 2 weeks ago

No, it is actually HTTP-RPC, refer to: https://github.com/trpc-group/trpc-go/tree/main/http

image

Does the pan-http rpc service support rpc-web client ? for example nice-rpc-web

WineChord commented 2 weeks ago

"pan-http rpc service" is essentially HTTP service, not of trpc/grpc protocols. You may try to use tgrpc server examples: https://github.com/trpc-ecosystem/go-codec/blob/main/grpc/examples/servers/tgrpc/main.go

ninesunqian commented 2 weeks ago

"pan-http rpc service" is essentially HTTP service, not of trpc/grpc protocols. You may try to use tgrpc server examples: https://github.com/trpc-ecosystem/go-codec/blob/main/grpc/examples/servers/tgrpc/main.go

Does it have js client ?

WineChord commented 2 weeks ago

You can assume it is served as a normal grpc service, any tool that is used to connect to grpc service can be used with it.

ninesunqian commented 1 week ago

You can assume it is served as a normal grpc service, any tool that is used to connect to grpc service can be used with it.

ok. Thank you!