Documentation
¶
Index ¶
Constants ¶
View Source
const ( ActionHello Action = "hello" ActionChatMessage = "message.chat" ActionChatMessageResend = "message.chat.resend" ActionGroupMessage = "message.group" ActionMessageFailed = "message.failed.send" ActionClientCustom = "message.cli" ActionNotifyNeedAuth = "notify.auth" ActionNotifyKickOut = "notify.kickout" ActionNotifyNewContact = "notify.contact" ActionNotifyGroup = "notify.group" ActionNotifyAccountLogin = "notify.login" ActionNotifyAccountLogout = "notify.logout" ActionNotifyError = "notify.error" ActionNotifyUnknownAction = "notify.unknown.action" ActionAckRequest = "ack.request" ActionAckGroupMsg = "ack.group.msg" ActionAckMessage = "ack.message" ActionAckNotify = "ack.notify" ActionHeartbeat = "heartbeat" ActionApiAuth = "api.auth" ActionApiFailed = "api.failed" ActionApiSuccess = "api.success" )
Variables ¶
View Source
var DefaultCodec = JsonCodec
View Source
var JsonCodec = jsonCodec{}
View Source
var ProtoBuffCodec = protobufCodec{}
Functions ¶
This section is empty.
Types ¶
type AckGroupMessage ¶
type AckGroupMessage struct {
Gid int64 `json:"gid"`
Mid int64 `json:"mid"`
Seq int64 `json:"seq"`
}
AckGroupMessage 发送群消息服务器回执
type AckMessage ¶
AckMessage 服务端通知发送者的服务端收到消息
type AckRequest ¶
AckRequest 接收者回复给服务端确认收到消息
type ChatMessage ¶
type ChatMessage struct {
Mid int64 `json:"mid"`
Seq int64 `json:"seq"`
From int64 `json:"from"`
To int64 `json:"to"`
Type int32 `json:"type"`
Content string `json:"content"`
SendAt int64 `json:"sendAt"`
}
ChatMessage chat message in single/group chat
type ClientCustom ¶
type ClientCustom struct {
From int64 `json:"from"`
To int64 `json:"to"`
Type int32 `json:"type"`
Content string `json:"content"`
}
ClientCustom client custom message, server does not store to database.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data used to wrap message data. Server received a message, the data type is []byte, it's waiting for deserialize to specified struct. When server push a message to client, the data type is specific struct.
func (*Data) Deserialize ¶
func (*Data) MarshalJSON ¶
func (*Data) UnmarshalJSON ¶
type GlideMessage ¶
type GlideMessage struct {
Ver int64 `json:"ver,omitempty"`
Seq int64 `json:"seq,omitempty"`
Action string `json:"action"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Data *Data `json:"data,omitempty"`
Extra map[string]string `json:"extra,omitempty"`
}
GlideMessage common data of all message
func NewEmptyMessage ¶
func NewEmptyMessage() *GlideMessage
func NewMessage ¶
func NewMessage(seq int64, action Action, data interface{}) *GlideMessage
func (*GlideMessage) GetAction ¶
func (g *GlideMessage) GetAction() Action
func (*GlideMessage) GetSeq ¶
func (g *GlideMessage) GetSeq() int64
func (*GlideMessage) SetSeq ¶
func (g *GlideMessage) SetSeq(seq int64)
func (*GlideMessage) String ¶ added in v1.2.1
func (g *GlideMessage) String() string
type GlideProtocol ¶
type GlideProtocol struct {
}
Click to show internal directories.
Click to hide internal directories.