Documentation ¶
Overview ¶
Package chat is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterChatServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterChatServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChatServiceClient) error
- func RegisterChatServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterChatServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChatServiceServer) error
- func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceServer)
- type ChatServiceClient
- type ChatServiceServer
- type ChatService_ChatClient
- type ChatService_ChatServer
- type Message
- type UnimplementedChatServiceServer
- type UnsafeChatServiceServer
Constants ¶
const (
ChatService_Chat_FullMethodName = "/chat.ChatService/Chat"
)
Variables ¶
var ChatService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "chat.ChatService", HandlerType: (*ChatServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Chat", Handler: _ChatService_Chat_Handler, ServerStreams: true, }, }, Metadata: "proto/chat.proto", }
ChatService_ServiceDesc is the grpc.ServiceDesc for ChatService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_proto_chat_proto protoreflect.FileDescriptor
Functions ¶
func RegisterChatServiceHandler ¶
func RegisterChatServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterChatServiceHandler registers the http handlers for service ChatService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterChatServiceHandlerClient ¶
func RegisterChatServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChatServiceClient) error
RegisterChatServiceHandlerClient registers the http handlers for service ChatService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChatServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChatServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ChatServiceClient" to call the correct interceptors.
func RegisterChatServiceHandlerFromEndpoint ¶
func RegisterChatServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterChatServiceHandlerFromEndpoint is same as RegisterChatServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterChatServiceHandlerServer ¶
func RegisterChatServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChatServiceServer) error
RegisterChatServiceHandlerServer registers the http handlers for service ChatService to "mux". UnaryRPC :call ChatServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterChatServiceHandlerFromEndpoint instead.
func RegisterChatServiceServer ¶
func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceServer)
Types ¶
type ChatServiceClient ¶
type ChatServiceClient interface {
Chat(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (ChatService_ChatClient, error)
}
ChatServiceClient is the client API for ChatService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewChatServiceClient ¶
func NewChatServiceClient(cc grpc.ClientConnInterface) ChatServiceClient
type ChatServiceServer ¶
type ChatServiceServer interface {
Chat(*emptypb.Empty, ChatService_ChatServer) error
}
ChatServiceServer is the server API for ChatService service. All implementations should embed UnimplementedChatServiceServer for forward compatibility
type ChatService_ChatClient ¶
type ChatService_ChatClient interface { Recv() (*Message, error) grpc.ClientStream }
type ChatService_ChatServer ¶
type ChatService_ChatServer interface { Send(*Message) error grpc.ServerStream }
type Message ¶
type Message struct { User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // contains filtered or unexported fields }
func (*Message) Descriptor
deprecated
func (*Message) GetContent ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type UnimplementedChatServiceServer ¶
type UnimplementedChatServiceServer struct { }
UnimplementedChatServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedChatServiceServer) Chat ¶
func (UnimplementedChatServiceServer) Chat(*emptypb.Empty, ChatService_ChatServer) error
type UnsafeChatServiceServer ¶
type UnsafeChatServiceServer interface {
// contains filtered or unexported methods
}
UnsafeChatServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ChatServiceServer will result in compilation errors.