Created
October 14, 2021 15:03
-
-
Save bopin2020/1474f0dd8679242bfe8fb0041c040ca8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
// ========================================== Import proto | |
// import "annotations.proto"; | |
// import "http.proto"; | |
// import "google/protobuf/empty.proto"; | |
// ========================================== | |
option csharp_namespace = "GrpcTeamServer"; | |
package greet; | |
// The greeting service definition. package/service/rpc | |
service Greeter { | |
// method 1 | |
// Unary | |
// Sends a greeting | |
rpc SayHello (HelloRequest) returns (HelloReply); | |
// https://docs.microsoft.com/en-us/aspnet/core/grpc/services?view=aspnetcore-5.0 | |
// rcp stream | |
// method 2 | |
// server streaming | |
rpc StreamingFromServer (HelloRequest) returns (stream HelloReply); | |
// method 3 | |
// Client streaming | |
rpc StreamingFromClient (stream HelloRequest) returns (HelloReply); | |
// method 4 | |
// Bi-directional streaming | |
rpc StreamingBothWays(stream HelloRequest) returns (stream HelloReply); | |
/* | |
Each call type has a different method signature. overridiing generated methods from the abstract base service type | |
in a concrete implementation ensures the correct arguments and return type are used. | |
*/ | |
} | |
// gRPC 认证服务 | |
service Auth{ | |
rpc BearerTokenAuth (AuthRequest) returns (AuthResponse); | |
} | |
service DataByte{ | |
rpc WriteFileBytes (FileName) returns (FileBin); | |
} | |
message FileName | |
{ | |
string filename = 1; | |
} | |
message FileBin | |
{ | |
string data = 1; | |
} | |
// The request message containing the user's name. | |
message HelloRequest { | |
string name = 1; | |
string message = 2; | |
} | |
// The response message containing the greetings. | |
message HelloReply { | |
string message = 1; | |
string name = 2; | |
} | |
message AuthRequest{ | |
string username = 1; | |
string password = 2; | |
} | |
message AuthResponse{ | |
string username = 1; | |
string Token = 2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment