LANYINGDevelopers
Web & Mini ProgramiOSAndroidC++Server API

floo::BMXMessage#

Message

#include <bmx_message.h>

Inherits from BMXBaseObject

Public Types#

Name
enum classDeliveryStatus { New, Delivering, Deliveried, Failed, Recalled}
Messaging state
enum classMessageType { Single, Group, System}
Message type
enum classContentType { Text, Image, Voice, Video, File, Location, Command, Forward}
Type of message content
enum classDeliveryQos { AtLastOnce, AtMostOnce, ExactlyOnce}
Messaging quality

Public Functions#

Name
virtual~BMXMessage()
Destructor
int64_tmsgId()
Message unique ID
int64_tclientMsgId()
Message client ID, only exists on message sender-side
int64_tfromId()
Message sender ID
int64_ttoId()
Message receiver ID
MessageTypetype()
Message type
int64_tconversationId()
Conversation ID that message belongs to
DeliveryStatusdeliveryStatus()
Messaging state
voidsetDeliveryStatus(DeliveryStatus )
Set messaging state
int64_tserverTimestamp()
Message timestamp (when received by server-side)
voidsetServerTimestamp(int64_t )
Set message timestamp (when received by server-side)
int64_tclientTimestamp()
Local timestamp (local time when message created or received)
voidsetClientTimestamp(int64_t )
Set message local timestamp
boolisPlayed()
Whether voice or video message has been played, valid only for received audio/video messages
voidsetIsPlayed(bool )
Set whether a voice or video message has been played, valid only for received audio or video messages
boolisPlayAcked()
Means whether playback acknowledgement received for sender, and whether playback acknowledgement sent for receiver
voidsetIsPlayAcked(bool )
Set playback acknowledgement
boolisReceiveMsg()
Message whether to receive
voidsetIsReceiveMsg(bool )
Message to set receiving condition
boolisRead()
Message read or unread mark
voidsetIsRead(bool )
Message read or unread mark
boolisReadAcked()
Show sender whether read acknowledgement received, and show receiver whether message read acknowledgement sent
voidsetIsReadAcked(bool )
Set read acknowledgement
boolisDeliveryAcked()
Show sender whether message has been delivered to the other party, and show receiver whether message delivered acknowledgement has been sent
voidsetIsDeliveryAcked(bool )
Set delivery acknowledgement
const std::string &content()
Message text content
voidsetContent(const std::string & content)
Message text content
ContentTypecontentType()
Message content type, attachment-type with attachment, text-type with no attachment
BMXMessageAttachmentPtrattachment()
Message attachment, BMXMessage owns the attachment and is responsible for releasing it
BMXMessageConfigPtrconfig()
Message settings
voidsetConfig(BMXMessageConfigPtr )
Set message config information
const JSON &extension()
Message extension information
voidsetExtension(const JSON & )
Set message extension information
DeliveryQosdeliveryQos()
QOS of messaging
voidsetDeliveryQos(DeliveryQos qos)
Set QOS of messaging
const std::string &senderName()
Display name of message sender
voidsetSenderName(const std::string & senderName)
Set display name of message sender
intgroupAckCount()
AckCount of read group messages
voidsetGroupAckCount(int count)
Set groupAckCount of read messages (an SDK internal calling interface that shall not be called by upper layer)
intgroupAckUnreadCount()
AckCount of unread group messages
voidsetGroupAckUnreadCount(int count)
Set groupAckCount of unread messages (an SDK internal calling interface that shall not be called by upper layer)
boolgroupAckReadAll()
Whether all group messages are read
intgroupPlayAckCount()
AckCount of played group messages (valid only for messages with audio/video attachment)
voidsetGroupPlayAckCount(int count)
Set groupAckCount of played messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)
intgroupPlayAckUnreadCount()
AckCount of unplayed group messages (valid only for messages with audio/video attachment)
voidsetGroupPlayAckUnreadCount(int count)
Set groupAckCount of unplayed messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)
boolgroupPlayAckReadAll()
Whether all group messages have been played
voidsetPriority(int priority)
Set message diffusion priority, default 0. 0 means diffusion, and the smaller the number, the more diffused.
intpriority()
Message diffusion priority
voidsetPushMessageMode(bool )
Set whether the message is a push.
boolisPushMessage()
Whether the message is a push
BMXMessagePtrcreateMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content)
Create a text message
BMXMessagePtrcreateMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, BMXMessageAttachmentPtr attachment)
Create a sent-attachment message
BMXMessagePtrcreateCommandMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content)
Create a sent command message (command message holds command information in a content field or an extension field)
BMXMessagePtrcreateMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content, int64_t serverTimestamp)
Create a received message
BMXMessagePtrcreateMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, BMXMessageAttachmentPtr attachment, int64_t serverTimestamp)
Create a received message
BMXMessagePtrcreateCommandMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content, int64_t serverTimestamp)
Create a received command message (command message holds command information in a content field or an extension field)
BMXMessagePtrcreateForwardMessage(BMXMessagePtr msg, int64_t from, int64_t to, MessageType type, int64_t conversationId)
Create a forwarding message

Public Types Documentation#

enum DeliveryStatus#

EnumeratorValueDescription
NewNewly created message
DeliveringMessage delivering
DeliveriedMessage delivered
FailedMessage delivery failed
RecalledMessage delivery canceled

Message delivery status

enum MessageType#

EnumeratorValueDescription
SingleSingle chat message
GroupGroup chat message
SystemSystem message

Message type

enum ContentType#

EnumeratorValueDescription
TextText message
ImageImage message
VoiceVoice message
VideoVideo clip message
FileFile message
LocationLocation message
CommandCommand message
ForwardForward message

Message content type

enum DeliveryQos#

EnumeratorValueDescription
AtLastOnceDeliver at least once
AtMostOnceDeliver at most once
ExactlyOnceDeliver only once

Message delivery QoS

Public Functions Documentation#

function ~BMXMessage#

virtual ~BMXMessage()

Destructor

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="~BMXMessage" %}{% endlanying_code_snippet %}

function msgId#

int64_t msgId()

Message unique ID

Return: int64_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="msgId" %}{% endlanying_code_snippet %}

function clientMsgId#

int64_t clientMsgId()

Message client ID, only exists on message sender-side

Return: int64_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="clientMsgId" %}{% endlanying_code_snippet %}

function fromId#

int64_t fromId()

Message sender ID

Return: int64_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="fromId" %}{% endlanying_code_snippet %}

function toId#

int64_t toId()

Message receiver ID

Return: int64_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="toId" %}{% endlanying_code_snippet %}

function type#

MessageType type()

Message type

Return: MessageType

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="type" %}{% endlanying_code_snippet %}

function conversationId#

int64_t conversationId()

Conversation ID that message belongs to

Return: int64_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="conversationId" %}{% endlanying_code_snippet %}

function deliveryStatus#

DeliveryStatus deliveryStatus()

Message delivery status

Return: DeliveryStatus

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="deliveryStatus" %}{% endlanying_code_snippet %}

function setDeliveryStatus#

void setDeliveryStatus(
    DeliveryStatus 
)

Set messaging state

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setDeliveryStatus" %}{% endlanying_code_snippet %}

function serverTimestamp#

int64_t serverTimestamp()

Message timestamp (when received by server-side)

Return: int64_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="serverTimestamp" %}{% endlanying_code_snippet %}

function setServerTimestamp#

void setServerTimestamp(
    int64_t 
)

Set message timestamp (when received by server-side)

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setServerTimestamp" %}{% endlanying_code_snippet %}

function clientTimestamp#

int64_t clientTimestamp()

Local timestamp (local time when message created or received)

Return: int64_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="clientTimestamp" %}{% endlanying_code_snippet %}

function setClientTimestamp#

void setClientTimestamp(
    int64_t 
)

Set message local timestamp

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setClientTimestamp" %}{% endlanying_code_snippet %}

function isPlayed#

bool isPlayed()

Whether voice or video message has been played, valid only for received audio/video messages

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isPlayed" %}{% endlanying_code_snippet %}

function setIsPlayed#

void setIsPlayed(
    bool 
)

Set whether a voice or video message has been played, valid only for received audio or video messages

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsPlayed" %}{% endlanying_code_snippet %}

function isPlayAcked#

bool isPlayAcked()

Means whether playback acknowledgement received for sender, and whether playback acknowledgement sent for receiver

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isPlayAcked" %}{% endlanying_code_snippet %}

function setIsPlayAcked#

void setIsPlayAcked(
    bool 
)

Set playback acknowledgement

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsPlayAcked" %}{% endlanying_code_snippet %}

function isReceiveMsg#

bool isReceiveMsg()

Message whether to receive

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isReceiveMsg" %}{% endlanying_code_snippet %}

function setIsReceiveMsg#

void setIsReceiveMsg(
    bool 
)

Message to set receiving condition

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsReceiveMsg" %}{% endlanying_code_snippet %}

function isRead#

bool isRead()

Message read or unread mark

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isRead" %}{% endlanying_code_snippet %}

function setIsRead#

void setIsRead(
    bool 
)

Message read or unread mark

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsRead" %}{% endlanying_code_snippet %}

function isReadAcked#

bool isReadAcked()

Show sender whether read acknowledgement received, and show receiver whether message read acknowledgement sent

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isReadAcked" %}{% endlanying_code_snippet %}

function setIsReadAcked#

void setIsReadAcked(
    bool 
)

Set read acknowledgement

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsReadAcked" %}{% endlanying_code_snippet %}

function isDeliveryAcked#

bool isDeliveryAcked()

Show sender whether message has been delivered to the other party, and show receiver whether message delivered acknowledgement has been sent

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isDeliveryAcked" %}{% endlanying_code_snippet %}

function setIsDeliveryAcked#

void setIsDeliveryAcked(
    bool 
)

Set delivery acknowledgement

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsDeliveryAcked" %}{% endlanying_code_snippet %}

function content#

const std::string & content()

Message text content

Return: std::string

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="content" %}{% endlanying_code_snippet %}

function setContent#

void setContent(
    const std::string & content
)

Message text content

Parameters:

  • content Message text content

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setContent" %}{% endlanying_code_snippet %}

function contentType#

ContentType contentType()

Message content type, attachment-type with attachment, text-type with no attachment

Return: ContentType

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="contentType" %}{% endlanying_code_snippet %}

function attachment#

BMXMessageAttachmentPtr attachment()

Message attachment, BMXMessage owns the attachment and is responsible for releasing it

Return: BMXMessageAttachmentPtr

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="attachment" %}{% endlanying_code_snippet %}

function config#

BMXMessageConfigPtr config()

Message settings

Return: JSON(std::string)

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="config" %}{% endlanying_code_snippet %}

function setConfig#

void setConfig(
    BMXMessageConfigPtr 
)

Set message config information

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setConfig" %}{% endlanying_code_snippet %}

function extension#

const JSON & extension()

Message extension information

Return: JSON(std::string)

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="extension" %}{% endlanying_code_snippet %}

function setExtension#

void setExtension(
    const JSON & 
)

Set message extension information

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setExtension" %}{% endlanying_code_snippet %}

function deliveryQos#

DeliveryQos deliveryQos()

QOS of messaging

Return: DeliveryQos

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="deliveryQos" %}{% endlanying_code_snippet %}

function setDeliveryQos#

void setDeliveryQos(
    DeliveryQos qos
)

Set QOS of messaging

Parameters:

  • qos QOS of messaging

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setDeliveryQos" %}{% endlanying_code_snippet %}

function senderName#

const std::string & senderName()

Display name of message sender

Return: std::string

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="senderName" %}{% endlanying_code_snippet %}

function setSenderName#

void setSenderName(
    const std::string & senderName
)

Set display name of message sender

Parameters:

  • senderName Message text content

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setSenderName" %}{% endlanying_code_snippet %}

function groupAckCount#

int groupAckCount()

AckCount of read group messages

Return: int

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupAckCount" %}{% endlanying_code_snippet %}

function setGroupAckCount#

void setGroupAckCount(
    int count
)

Set groupAckCount of read messages (an SDK internal calling interface that shall not be called by upper layer)

Parameters:

  • count Set the number of read group messages

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setGroupAckCount" %}{% endlanying_code_snippet %}

function groupAckUnreadCount#

int groupAckUnreadCount()

AckCount of unread group messages

Return: int

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupAckUnreadCount" %}{% endlanying_code_snippet %}

function setGroupAckUnreadCount#

void setGroupAckUnreadCount(
    int count
)

Set groupAckCount of unread messages (an SDK internal calling interface that shall not be called by upper layer)

Parameters:

  • count Set the number of unread group messages

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setGroupAckUnreadCount" %}{% endlanying_code_snippet %}

function groupAckReadAll#

bool groupAckReadAll()

Whether all group messages are read

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupAckReadAll" %}{% endlanying_code_snippet %}

function groupPlayAckCount#

int groupPlayAckCount()

AckCount of played group messages (valid only for messages with audio/video attachment)

Return: int

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupPlayAckCount" %}{% endlanying_code_snippet %}

function setGroupPlayAckCount#

void setGroupPlayAckCount(
    int count
)

Set groupAckCount of played messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)

Parameters:

  • count Set the number of read group messages

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setGroupPlayAckCount" %}{% endlanying_code_snippet %}

function groupPlayAckUnreadCount#

int groupPlayAckUnreadCount()

AckCount of unplayed group messages (valid only for messages with audio/video attachment)

Return: int

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupPlayAckUnreadCount" %}{% endlanying_code_snippet %}

function setGroupPlayAckUnreadCount#

void setGroupPlayAckUnreadCount(
    int count
)

Set groupAckCount of unplayed messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)

Parameters:

  • count Set the number of unplayed group messages

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setGroupPlayAckUnreadCount" %}{% endlanying_code_snippet %}

function groupPlayAckReadAll#

bool groupPlayAckReadAll()

Whether all group messages have been played

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupPlayAckReadAll" %}{% endlanying_code_snippet %}

function setPriority#

void setPriority(
    int priority
)

Set message diffusion priority, default 0. 0 means diffusion, and the smaller the number, the more diffused.

Parameters:

  • priority Set the number of unread group messages

Value range 0-10. The default level of messages sent by ordinary users in chatroom is 5, which can be discarded. Admin level defaults to 0 and will not be discarded. Other values can be set according to business.

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setPriority" %}{% endlanying_code_snippet %}

function priority#

int priority()

Message diffusion priority

Return: int

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="priority" %}{% endlanying_code_snippet %}

function setPushMessageMode#

void setPushMessageMode(
    bool 
)

Set whether the message is a push.

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setPushMessageMode" %}{% endlanying_code_snippet %}

function isPushMessage#

bool isPushMessage()

Whether the message is a push

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isPushMessage" %}{% endlanying_code_snippet %}

function createMessage#

static BMXMessagePtr createMessage(
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    const std::string & content
)

Create a text message

Parameters:

  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • content Message content

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createMessage" %}{% endlanying_code_snippet %}

function createMessage#

static BMXMessagePtr createMessage(
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    BMXMessageAttachmentPtr attachment
)

Create a sent-attachment message

Parameters:

  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • attachment Attachment

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createMessage" %}{% endlanying_code_snippet %}

function createCommandMessage#

static BMXMessagePtr createCommandMessage(
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    const std::string & content
)

Create a sent command message (command message holds command information in a content field or an extension field)

Parameters:

  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • content Message content

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createCommandMessage" %}{% endlanying_code_snippet %}

function createMessage#

static BMXMessagePtr createMessage(
    int64_t msgId,
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    const std::string & content,
    int64_t serverTimestamp
)

Create a received message

Parameters:

  • msgId Message id
  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • content Message content
  • serverTimestamp Server timestamp

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createMessage" %}{% endlanying_code_snippet %}

function createMessage#

static BMXMessagePtr createMessage(
    int64_t msgId,
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    BMXMessageAttachmentPtr attachment,
    int64_t serverTimestamp
)

Create a received message

Parameters:

  • msgId Message id
  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • attachment Attachment
  • serverTimestamp Server timestamp

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createMessage" %}{% endlanying_code_snippet %}

function createCommandMessage#

static BMXMessagePtr createCommandMessage(
    int64_t msgId,
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    const std::string & content,
    int64_t serverTimestamp
)

Create a received command message (command message holds command information in a content field or an extension field)

Parameters:

  • msgId Message id
  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • content Message content
  • serverTimestamp Server timestamp

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createCommandMessage" %}{% endlanying_code_snippet %}

function createForwardMessage#

static BMXMessagePtr createForwardMessage(
    BMXMessagePtr msg,
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId
)

Create a forwarding message

Parameters:

  • msg Message to forward
  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createForwardMessage" %}{% endlanying_code_snippet %}

Updated on 2022-01-26 at 17:20:40 +0800

Generated API content with concise AI notes where context helps.