github.com/glide-im/glide@v1.6.0/pkg/messages/messages.go (about)

     1  package messages
     2  
     3  // ChatMessage chat message in single/group chat
     4  type ChatMessage struct {
     5  	/// client message id to identity unique a message.
     6  	/// for identity a message
     7  	/// and wait for the server ack receipt and return `mid` for it.
     8  	CliMid string `json:"cliMid,omitempty"`
     9  	/// server message id in the database.
    10  	// when a client sends a message for the first time or  client retry to send a message that
    11  	// the server does not ack, the 'Mid' is empty.
    12  	/// if this field is not empty that this message is server acked, need not store to database again.
    13  	Mid int64 `json:"mid,omitempty"`
    14  	/// message sequence for a chat, use to check message whether the message lost.
    15  	Seq int64 `json:"seq,omitempty"`
    16  	/// message sender
    17  	From string `json:"from,omitempty"`
    18  	/// message send to
    19  	To string `json:"to,omitempty"`
    20  	/// message type
    21  	Type int32 `json:"type,omitempty"`
    22  	/// message content
    23  	Content string `json:"content,omitempty"`
    24  	/// message send time, server store message time.
    25  	SendAt int64 `json:"sendAt,omitempty"`
    26  }
    27  
    28  // ClientCustom client custom message, server does not store to database.
    29  type ClientCustom struct {
    30  	Type    string      `json:"type,omitempty"`
    31  	Content interface{} `json:"content,omitempty"`
    32  }
    33  
    34  // AckRequest 接收者回复给服务端确认收到消息
    35  type AckRequest struct {
    36  	Seq  int64  `json:"seq,omitempty"`
    37  	Mid  int64  `json:"mid,omitempty"`
    38  	From string `json:"from,omitempty"`
    39  }
    40  
    41  // AckGroupMessage 发送群消息服务器回执
    42  type AckGroupMessage struct {
    43  	CliMid string `json:"cliMid,omitempty"`
    44  	Gid    int64  `json:"gid,omitempty"`
    45  	Mid    int64  `json:"mid,omitempty"`
    46  	Seq    int64  `json:"seq,omitempty"`
    47  }
    48  
    49  // AckMessage 服务端通知发送者的服务端收到消息
    50  type AckMessage struct {
    51  	CliMid string `json:"cliMid,omitempty"`
    52  	/// message id to tall the client
    53  	Mid int64 `json:"mid,omitempty"`
    54  	Seq int64 `json:"seq,omitempty"`
    55  }
    56  
    57  // AckNotify 服务端下发给发送者的消息送达通知
    58  type AckNotify struct {
    59  	Mid int64 `json:"mid,omitempty"`
    60  }
    61  
    62  type KickOutNotify struct {
    63  	DeviceId   string `json:"device_id,omitempty"`
    64  	DeviceName string `json:"device_name,omitempty"`
    65  }