chat

package
v0.0.0-...-44fef55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package chat is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ChatService_Chat_FullMethodName = "/chat.ChatService/Chat"
)

Variables

View Source
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)

View Source
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.

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) Descriptor() ([]byte, []int)

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetContent

func (x *Message) GetContent() string

func (*Message) GetUser

func (x *Message) GetUser() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

func (x *Message) ProtoReflect() protoreflect.Message

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type UnimplementedChatServiceServer

type UnimplementedChatServiceServer struct {
}

UnimplementedChatServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedChatServiceServer) Chat

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL