chat

package
v0.0.0-...-3989710 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChatService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "chat.ChatService",
	HandlerType: (*ChatServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CloseConnection",
			Handler:    _ChatService_CloseConnection_Handler,
		},
		{
			MethodName: "Publish",
			Handler:    _ChatService_Publish_Handler,
		},
		{
			MethodName: "Broadcast",
			Handler:    _ChatService_Broadcast_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "OpenConnection",
			Handler:       _ChatService_OpenConnection_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "Message.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_Message_proto protoreflect.FileDescriptor

Functions

func RegisterChatServiceServer

func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceServer)

Types

type ChatServiceClient

type ChatServiceClient interface {
	OpenConnection(ctx context.Context, in *Connect, opts ...grpc.CallOption) (ChatService_OpenConnectionClient, error)
	CloseConnection(ctx context.Context, in *User, opts ...grpc.CallOption) (*Close, error)
	Publish(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error)
	Broadcast(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Close, 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 {
	OpenConnection(*Connect, ChatService_OpenConnectionServer) error
	CloseConnection(context.Context, *User) (*Close, error)
	Publish(context.Context, *Message) (*Message, error)
	Broadcast(context.Context, *Message) (*Close, error)
	// contains filtered or unexported methods
}

ChatServiceServer is the server API for ChatService service. All implementations must embed UnimplementedChatServiceServer for forward compatibility

type ChatService_OpenConnectionClient

type ChatService_OpenConnectionClient interface {
	Recv() (*Message, error)
	grpc.ClientStream
}

type ChatService_OpenConnectionServer

type ChatService_OpenConnectionServer interface {
	Send(*Message) error
	grpc.ServerStream
}

type Close

type Close struct {
	// contains filtered or unexported fields
}

func (*Close) Descriptor deprecated

func (*Close) Descriptor() ([]byte, []int)

Deprecated: Use Close.ProtoReflect.Descriptor instead.

func (*Close) ProtoMessage

func (*Close) ProtoMessage()

func (*Close) ProtoReflect

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

func (*Close) Reset

func (x *Close) Reset()

func (*Close) String

func (x *Close) String() string

type Connect

type Connect struct {
	User   *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	Active bool  `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"`
	// contains filtered or unexported fields
}

func (*Connect) Descriptor deprecated

func (*Connect) Descriptor() ([]byte, []int)

Deprecated: Use Connect.ProtoReflect.Descriptor instead.

func (*Connect) GetActive

func (x *Connect) GetActive() bool

func (*Connect) GetUser

func (x *Connect) GetUser() *User

func (*Connect) ProtoMessage

func (*Connect) ProtoMessage()

func (*Connect) ProtoReflect

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

func (*Connect) Reset

func (x *Connect) Reset()

func (*Connect) String

func (x *Connect) String() string

type Message

type Message struct {
	Body      string `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
	User      *User  `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	Timestamp int32  `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

func (*Message) Descriptor() ([]byte, []int)

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetBody

func (x *Message) GetBody() string

func (*Message) GetTimestamp

func (x *Message) GetTimestamp() int32

func (*Message) GetUser

func (x *Message) GetUser() *User

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 must be embedded to have forward compatible implementations.

func (UnimplementedChatServiceServer) Broadcast

func (UnimplementedChatServiceServer) CloseConnection

func (UnimplementedChatServiceServer) OpenConnection

func (UnimplementedChatServiceServer) Publish

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.

type User

type User struct {
	Id        int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name      string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Timestamp int32  `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

func (*User) Descriptor() ([]byte, []int)

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetId

func (x *User) GetId() int64

func (*User) GetName

func (x *User) GetName() string

func (*User) GetTimestamp

func (x *User) GetTimestamp() int32

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

Jump to

Keyboard shortcuts

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