Documentation ¶
Index ¶
- Variables
- func NewService() *service
- type Broker
- type Client
- type Hub
- type Message
- type Option
- type Options
- type Queue
- func (q *Queue) GetAppInfo(key string) (map[string]string, error)
- func (q *Queue) GetKey(project, dest string) string
- func (q *Queue) GetUnreadList(project, dest string) ([]string, error)
- func (q *Queue) Remove(project, dest, message string) (int64, error)
- func (q *Queue) Save(project, dest, message string) error
- type ValidMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultName = "go-chat" DefaultVersion = "latest" DefaultTopic = "go.micro.web.chat" )
Functions ¶
func NewService ¶
func NewService() *service
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub maintains the set of active clients and broadcasts messages to the clients.
type Message ¶
type Message struct { ID string `json:"id"` // 客户端唯一编码 //ChatType string `json:"chatType"` // 单聊、群聊(singleChat、groupChat) //GroupID string `json:"groupID"` // 群组(群、公聊、聊天室),ChatType为groupChat时有效 Type string `json:"type"` // 消息类型 From string `json:"from"` // 来自 To string `json:"to"` // 去向 Content string `json:"content"` // 内容 Project string `json:"project"` // 项目ID,用于实现多项目通用 }
Message 消息结构体 TODO: 支持群聊
type Queue ¶
type Queue struct { ChatKeyPrefix string AppKeyPrefix string // contains filtered or unexported fields }
func (*Queue) GetAppInfo ¶
GetAppInfo 查询app信息
func (*Queue) GetUnreadList ¶
GetUnreadList 获得用户所有未读记录
Click to show internal directories.
Click to hide internal directories.