Skip to content

Commit

Permalink
chore: update generated echo example
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad committed Jun 9, 2024
1 parent 05f5f1a commit 95647c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
7 changes: 5 additions & 2 deletions _example/proto/echo_jgw.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 5 additions & 14 deletions _example/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ func main() {
log.Fatal(err)
}

echoClient, err := newGRPCClient()
grpcConn, err := grpc.NewClient(
address,
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
log.Fatal(err)
}

httpSv, jrpcLis, err := newJrpcSv(proto.NewEchoServiceJsonRpcService(echoClient))
httpSv, jrpcLis, err := newJrpcSv(proto.RegisterEchoServiceJsonRpcService(grpcConn))
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -110,18 +113,6 @@ func newGRPCSv(server *Server) (*grpc.Server, net.Listener, error) {
return sv, listener, nil
}

func newGRPCClient() (proto.EchoServiceClient, error) {
grpcConn, err := grpc.NewClient(
address,
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
return nil, err
}

return proto.NewEchoServiceClient(grpcConn), nil
}

func newJrpcSv(echoClient *proto.EchoServiceJsonRpcService) (*jrpc.Server, net.Listener, error) {
jrpcSv := jrpc.NewServer()

Expand Down

0 comments on commit 95647c5

Please sign in to comment.