Signaling (previously RTM) SDK v1.5.0 API Reference for Linux (C++)
Public Member Functions | Protected Member Functions | List of all members
agora::rtm::IMessage Class Referenceabstract

#include <IAgoraRtmService.h>

Inherited by agora::rtm::IFileMessage, and agora::rtm::IImageMessage.

Public Member Functions

virtual long long  getMessageId () const =0
 
virtual MESSAGE_TYPE  getMessageType () const =0
 
virtual void  setText (const char *str)=0
 
virtual const char *  getText () const =0
 
virtual const char *  getRawMessageData () const =0
 
virtual int  getRawMessageLength () const =0
 
virtual long long  getServerReceivedTs () const =0
 
virtual bool  isOfflineMessage () const =0
 
virtual void  release ()=0
 

Protected Member Functions

virtual  ~IMessage ()
 

Constructor & Destructor Documentation

◆ ~IMessage()

virtual agora::rtm::IMessage::~IMessage ( )
inlineprotectedvirtual

Member Function Documentation

◆ getMessageId()

virtual long long agora::rtm::IMessage::getMessageId ( ) const
pure virtual

Retrieves the unique ID of the message.

Returns
The message ID.

◆ getMessageType()

virtual MESSAGE_TYPE agora::rtm::IMessage::getMessageType ( ) const
pure virtual

Retrieves the message type.

Returns
The message type. See MESSAGE_TYPE.

◆ setText()

virtual void agora::rtm::IMessage::setText ( const char *  str )
pure virtual

Sets the content of a text message, or the text description of a raw message.

Parameters
str The text message to be set. Must not exceed 32 KB in length. If the message is a raw message, ensure that the overall size of the text description and the raw message data does not exceed 32 KB.

◆ getText()

virtual const char * agora::rtm::IMessage::getText ( ) const
pure virtual

Retrieves the content of a text message, or the text description of a raw message.

Returns
The content of the received text message, or the text description of the received raw message.

◆ getRawMessageData()

virtual const char * agora::rtm::IMessage::getRawMessageData ( ) const
pure virtual

Retrieves the starting address of the raw message in the memory.

Returns
The starting address of the raw message in the memory.

◆ getRawMessageLength()

virtual int agora::rtm::IMessage::getRawMessageLength ( ) const
pure virtual

Retrieves the length of the raw message.

Returns
The length of the raw message in Bytes.

◆ getServerReceivedTs()

virtual long long agora::rtm::IMessage::getServerReceivedTs ( ) const
pure virtual

Allows the receiver to retrieve the timestamp of when the messaging server receives this message.

Note
  • You can infer from the returned timestamp the approximate time as to when this message was sent.
  • The returned timestamp is on a millisecond time-scale. It is for demonstration purposes only, not for strict ordering of messages.
Returns
The timestamp (ms) of when the messaging server receives this message.

◆ isOfflineMessage()

virtual bool agora::rtm::IMessage::isOfflineMessage ( ) const
pure virtual

Allows the receiver to check whether this message has been cached on the server (Applies to peer-to-peer message only).

Note
  • This method returns false if a message is not cached by the server. Only if the sender sends the message as an offline message (sets enableOfflineMessaging as true) when the specified user is offline, does the method return true when the user is back online.
  • For now we only cache 200 offline messages for up to seven days for each message receiver. When the number of the cached messages reaches this limit, the newest message overrides the oldest one.
Returns
  • true: This message has been cached on the server (the server caches this message and re-sends it to the receiver when he/she is back online).
  • false: This message has not been cached on the server.

◆ release()

virtual void agora::rtm::IMessage::release ( )
pure virtual

Releases all resources used by the IMessage instance.

Note
For the message receiver: please access and save the content of the IMessage instance when receiving the onMessageReceived or the onMessageReceivedFromPeer callback. The SDK will release the IMessage instance when the callback ends.