Documentation ¶
Index ¶
- Variables
- type Connection
- type Message
- type Room
- type Server
- func (s *Server) CreateStream(connect *chatservice.StreamConnect, ...) error
- func (s *Server) RegisterOrJoinRoom(ctx context.Context, req *chatservice.RoomRequest) (*chatservice.RoomResponse, error)
- func (s *Server) RegisterOrLoginUser(ctx context.Context, req *chatservice.LoginRequest) (*chatservice.LoginResponse, error)
- func (s *Server) SendMessage(ctx context.Context, req *chatservice.ContentMessage) (*chatservice.Empty, error)
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var CollectionMessages *mongo.Collection
CollectionMessages is for message db
View Source
var CollectionRoom *mongo.Collection
CollectionRoom is for room db
View Source
var CollectionUser *mongo.Collection
CollectionUser is for user db
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is for Server have several connection ?
type Message ¶
type Message struct { SenderAlias string `bson:"sender_alias"` Message string `bson:"message"` Time string `bson:"timestamp"` }
Message is content message sent by user
type Server ¶
type Server struct {
Connnection []*Connection
}
Server is the interface service of this service
func (*Server) CreateStream ¶
func (s *Server) CreateStream(connect *chatservice.StreamConnect, stream chatservice.ChatService_CreateStreamServer) error
CreateStream is for stream the message to client
func (*Server) RegisterOrJoinRoom ¶
func (s *Server) RegisterOrJoinRoom(ctx context.Context, req *chatservice.RoomRequest) (*chatservice.RoomResponse, error)
RegisterOrJoinRoom is to register or join a room, user will move to other room if the requested user don't have room
func (*Server) RegisterOrLoginUser ¶
func (s *Server) RegisterOrLoginUser(ctx context.Context, req *chatservice.LoginRequest) (*chatservice.LoginResponse, error)
RegisterOrLoginUser is for login or register
func (*Server) SendMessage ¶
func (s *Server) SendMessage(ctx context.Context, req *chatservice.ContentMessage) (*chatservice.Empty, error)
SendMessage is for broadcast all message to client
Click to show internal directories.
Click to hide internal directories.