messages

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ActionChatMessage        Action = "message.chat"
	ActionChatMessageRecall         = "message.chat.recall" // TODO remove
	ActionChatMessageRetry          = "message.chat.retry"  // 消息重发, 服务器未ack
	ActionChatMessageResend         = "message.chat.resend" // 消息重发, 服务器已ack, 接收方未ack
	ActionGroupMessage              = "message.group"
	ActionGroupMessageRecall        = "message.group.recall" // TODO remove
	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"

	ActionAckRequest  = "ack.request"
	ActionAckGroupMsg = "ack.group.msg"
	ActionAckMessage  = "ack.message"
	ActionAckNotify   = "ack.notify"

	ActionApiAuth    = "api.auth"
	ActionHeartbeat  = "heartbeat"
	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
	Mid int64
	Seq int64
}

type AckMessage

type AckMessage struct {
	Mid int64
	Seq int64
}

AckMessage 服务端通知发送者的服务端收到消息

func NewAckMessage

func NewAckMessage(mid int64, seq int64) AckMessage

type AckNotify

type AckNotify struct {
	Mid int64
}

AckNotify 服务端下发给发送者的消息送达通知

func NewAckNotify

func NewAckNotify(mid int64) AckNotify

type AckRequest

type AckRequest struct {
	Seq  int64
	Mid  int64
	From int64
}

AckRequest 接收者回复给服务端确认收到消息

type Action

type Action string

type ChatMessage

type ChatMessage struct {
	// Mid 消息ID
	Mid int64
	// Seq 发送者消息 seq
	Seq int64
	// From internal
	From int64
	// To 接收者 ID
	To int64
	// Type 消息类型
	Type int32
	// Content 消息内容
	Content string
	// SendAt 发送时间
	SendAt int64
}

ChatMessage 上行消息, 表示服务端收到发送者的消息

type ClientCustom

type ClientCustom struct {
	From    int64
	To      int64
	Type    int32
	Content string
}

type Codec

type Codec interface {
	Decode(data []byte, i interface{}) error
	Encode(i interface{}) ([]byte, error)
}

type Data

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

func NewData

func NewData(d interface{}) *Data

func (*Data) Data

func (d *Data) Data() interface{}

func (*Data) Deserialize

func (d *Data) Deserialize(i interface{}) error

func (*Data) MarshalJSON

func (d *Data) MarshalJSON() ([]byte, error)

func (*Data) UnmarshalJSON

func (d *Data) UnmarshalJSON(bytes []byte) error

type GlideMessage

type GlideMessage struct {
	Ver    int64
	Seq    int64
	Action string
	Data   *Data
	Extra  map[string]string
}

func NewEmptyMessage

func NewEmptyMessage() *GlideMessage

func NewMessage

func NewMessage(seq int64, action Action, data interface{}) *GlideMessage

func (*GlideMessage) DeserializeData

func (g *GlideMessage) DeserializeData(i interface{}) error

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)

type GlideProtocol

type GlideProtocol struct {
}

type GroupNotify

type GroupNotify struct {
	Mid       int64
	Gid       int64
	Type      int64
	Seq       int64
	Timestamp int64
	Data      interface{}
}

type GroupNotifyMemberAdded

type GroupNotifyMemberAdded struct {
	Uid []int64
}

type GroupNotifyMemberRemove

type GroupNotifyMemberRemove struct {
	Uid []int64
}

type Recall

type Recall struct {
	RecallBy int64
	Mid      int64
}

Jump to

Keyboard shortcuts

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