chat

package
v0.0.0-...-9037efb Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

Functions

func RegisterChatServiceServer

func RegisterChatServiceServer(s *grpc.Server, srv ChatServiceServer)

Types

type ChatServiceClient

type ChatServiceClient interface {
	SayHello(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error)
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
	StreamChat(ctx context.Context, opts ...grpc.CallOption) (ChatService_StreamChatClient, error)
}

ChatServiceClient is the client API for ChatService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type ChatServiceServer

type ChatServiceServer interface {
	SayHello(context.Context, *Message) (*Message, error)
	Login(context.Context, *LoginRequest) (*LoginResponse, error)
	StreamChat(ChatService_StreamChatServer) error
}

ChatServiceServer is the server API for ChatService service.

type ChatService_StreamChatClient

type ChatService_StreamChatClient interface {
	Send(*StreamMessage) error
	Recv() (*StreamMessage, error)
	grpc.ClientStream
}

type ChatService_StreamChatServer

type ChatService_StreamChatServer interface {
	Send(*StreamMessage) error
	Recv() (*StreamMessage, error)
	grpc.ServerStream
}

type Client

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

Client structure to hold client info

type LoginRequest

type LoginRequest struct {
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginRequest) Descriptor deprecated

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

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetName

func (x *LoginRequest) GetName() string

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

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

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

type LoginResponse

type LoginResponse struct {
	Status  bool   `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
	Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
	Id      int32  `protobuf:"varint,5,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginResponse) Descriptor deprecated

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

Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.

func (*LoginResponse) GetId

func (x *LoginResponse) GetId() int32

func (*LoginResponse) GetMessage

func (x *LoginResponse) GetMessage() string

func (*LoginResponse) GetStatus

func (x *LoginResponse) GetStatus() bool

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) ProtoReflect

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

func (*LoginResponse) Reset

func (x *LoginResponse) Reset()

func (*LoginResponse) String

func (x *LoginResponse) String() string

type Message

type Message struct {
	Body string `protobuf:"bytes,1,opt,name=body,proto3" json:"body,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) 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 Server

type Server struct {
	IDCount int
	Clients map[string]*Client
}

Server implementation of grcp server interface

func NewServer

func NewServer() *Server

NewServer constructor for server type

func (*Server) Login

func (s *Server) Login(ctx context.Context, msg *LoginRequest) (*LoginResponse, error)

Login implementation of client login

func (*Server) SayHello

func (s *Server) SayHello(ctx context.Context, msg *Message) (*Message, error)

SayHello implementation of greeting function

func (*Server) StreamChat

func (s *Server) StreamChat(stream ChatService_StreamChatServer) error

StreamChat process continuous chat flow

type StreamMessage

type StreamMessage struct {
	Type    string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
	Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content,omitempty"`
	Name    string `protobuf:"bytes,8,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*StreamMessage) Descriptor deprecated

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

Deprecated: Use StreamMessage.ProtoReflect.Descriptor instead.

func (*StreamMessage) GetContent

func (x *StreamMessage) GetContent() string

func (*StreamMessage) GetName

func (x *StreamMessage) GetName() string

func (*StreamMessage) GetType

func (x *StreamMessage) GetType() string

func (*StreamMessage) ProtoMessage

func (*StreamMessage) ProtoMessage()

func (*StreamMessage) ProtoReflect

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

func (*StreamMessage) Reset

func (x *StreamMessage) Reset()

func (*StreamMessage) String

func (x *StreamMessage) String() string

type UnimplementedChatServiceServer

type UnimplementedChatServiceServer struct {
}

UnimplementedChatServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedChatServiceServer) Login

func (*UnimplementedChatServiceServer) SayHello

func (*UnimplementedChatServiceServer) StreamChat

Jump to

Keyboard shortcuts

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