Documentation
¶
Index ¶
- Variables
- func Init(opts ...sqlxt.Option) (*sqlx.DB, error)
- func Map(f func(interface{}) string, items []interface{}) []string
- func NewChatRepo(db *sqlx.DB) *chatRepo
- func NewWebsocketHandler(cli proto.ChatService) func(http.ResponseWriter, *http.Request)
- type AuthBody
- type Client
- func (c *Client) Close() error
- func (c *Client) Join(roomId string) error
- func (c *Client) Messages() <-chan *Message
- func (c *Client) Out(roomId string) error
- func (c *Client) RequestRooms() error
- func (c *Client) RequestUsers() error
- func (c *Client) Rooms() <-chan []*Room
- func (c *Client) Say(roomId, name, body string) error
- func (c *Client) Users() <-chan []*User
- type Conn
- type Handler
- func (h *Handler) Join(ctx context.Context, req *proto.JoinRequest, rsp *proto.JoinResponse) error
- func (h *Handler) Out(ctx context.Context, req *proto.OutRequest, rsp *proto.OutResponse) error
- func (h *Handler) Register(ctx context.Context, req *proto.RegisterRequest, rsp *proto.RegisterResponse) error
- func (h *Handler) Rooms(ctx context.Context, req *proto.RoomsRequest, rsp *proto.RoomsResponse) error
- func (h *Handler) Send(ctx context.Context, req *proto.SendRequest, rsp *proto.SendResponse) error
- func (h *Handler) Stream(ctx context.Context, req *proto.StreamRequest, stream proto.Chat_StreamStream) error
- func (h *Handler) Unregister(ctx context.Context, req *proto.UnregisterRequest, ...) error
- func (h *Handler) Users(ctx context.Context, req *proto.UsersRequest, rsp *proto.UsersResponse) error
- type Hub
- type Message
- type Repository
- type Room
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var (
AcceptEvent = []string{"message", "notify", "receipt", "candidate", "sdp"}
)
View Source
var (
Debug = true
)
View Source
var (
// 持久化队列的平台,此值不可随意更改,否则会收不到队列消息
MasterPlatform = "mobile"
)
Functions ¶
func NewChatRepo ¶
func NewWebsocketHandler ¶
func NewWebsocketHandler(cli proto.ChatService) func(http.ResponseWriter, *http.Request)
Types ¶
type Client ¶
type Client struct {
Id string
MentionName string
Password string
// contains filtered or unexported fields
}
A Client represents the connection between the application to the HipChat service.
func NewClientWithServerInfo ¶
func (*Client) Messages ¶
Messages returns a read-only channel of Message structs. After joining a room, messages will be sent on the channel.
func (*Client) RequestRooms ¶
func (*Client) RequestUsers ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) Join ¶
func (h *Handler) Join(ctx context.Context, req *proto.JoinRequest, rsp *proto.JoinResponse) error
func (*Handler) Out ¶
func (h *Handler) Out(ctx context.Context, req *proto.OutRequest, rsp *proto.OutResponse) error
func (*Handler) Register ¶
func (h *Handler) Register(ctx context.Context, req *proto.RegisterRequest, rsp *proto.RegisterResponse) error
func (*Handler) Rooms ¶
func (h *Handler) Rooms(ctx context.Context, req *proto.RoomsRequest, rsp *proto.RoomsResponse) error
func (*Handler) Send ¶
func (h *Handler) Send(ctx context.Context, req *proto.SendRequest, rsp *proto.SendResponse) error
func (*Handler) Stream ¶
func (h *Handler) Stream(ctx context.Context, req *proto.StreamRequest, stream proto.Chat_StreamStream) error
func (*Handler) Unregister ¶
func (h *Handler) Unregister(ctx context.Context, req *proto.UnregisterRequest, rsp *proto.UnregisterResponse) error
func (*Handler) Users ¶
func (h *Handler) Users(ctx context.Context, req *proto.UsersRequest, rsp *proto.UsersResponse) error
type Repository ¶
type Repository interface {
NewTx() (*sqlx.Tx, error)
// 查询用户已登录客户端
AvailableClient(uid, platform string) (*proto.Client, error)
// 房间列表
RequestRooms(uid string) ([]*proto.Room, error)
// 好友列表
RequestUsers(uid string) ([]*proto.User, error)
// 查询用户
GetUser(id string) (*proto.User, error)
// 注册用户
CreateUser(user *proto.User) error
// 修改用户信息
UpdateUser(user *proto.User) error
// 注销用户
DeleteUser(id string) error
// TODO 按关键字搜索房间
// TODO 获取房间信息
GetRoom(id string) (*proto.Room, error)
// TODO 创建房间(群聊)
CreateRoom(room *proto.Room) error
// TODO 更新部分群组信息
UpdateRoom(room *proto.Room) error
// TODO 删除房间
DeleteRoom(roomId string) error
// 成员列表
Members(roomId string, onlyManager bool) ([]*proto.User, error)
// TODO 加入房间
Join(uid, roomId string) error
// TODO 退出房间
Out(uid, roomId string) error
// 上线
Online(uid, platform string) error
// 下线
Offline(uid, platform string) error
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.