Public Member Functions

abstract void setText (String text)
 
abstract String getText ()
 
abstract void setRawMessage (byte[] data)
 
abstract void setRawMessage (byte[] data, String description)
 
abstract byte [] getRawMessage ()
 
abstract int getMessageType ()
 
abstract long getServerReceivedTs ()
 
abstract boolean isOfflineMessage ()
 

Detailed Description

Class for retrieving the attributes of an Agora RTM channel or peer-to-peer message.

Member Function Documentation

◆ setText()

abstract void io.agora.rtm.RtmMessage.setText ( String  text)
abstract

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

Note The maximum length is 32 KB.

Parameters
textThe content of the text message or the text description of the raw message.

◆ getText()

abstract String io.agora.rtm.RtmMessage.getText ( )
abstract

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

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

◆ setRawMessage() [1/2]

abstract void io.agora.rtm.RtmMessage.setRawMessage ( byte []  data)
abstract

Sets the payload of the raw message.

Note You can set a brief text description of the raw message at a later point using the setText method, but please ensure that the size of the raw message and the description combined does not exceed 32 KB.

Parameters
dataThe payload of the raw message. Must not exceed 32 KB in length.

◆ setRawMessage() [2/2]

abstract void io.agora.rtm.RtmMessage.setRawMessage ( byte []  data,
String  description 
)
abstract

Sets the payload and text description of the raw message.

Note You can set description as "" and add a brief text description of the raw message at a later point using the setText method, but please ensure that the size of the raw message and the description combined does not exceed 32 KB.

Parameters
dataThe payload of the raw message. Must not exceed 32 KB in length.
descriptionA brief text description of the raw message. If you set a text description, ensure that the size of the raw message and the description combined does not exceed 32 KB.

◆ getRawMessage()

abstract byte [] io.agora.rtm.RtmMessage.getRawMessage ( )
abstract

Retrieves the payload of the raw message.

Returns
The payload of the raw message.

◆ getMessageType()

abstract int io.agora.rtm.RtmMessage.getMessageType ( )
abstract

Retrieves the message type.

Returns
The message type. See RtmMessageType.

◆ getServerReceivedTs()

abstract long io.agora.rtm.RtmMessage.getServerReceivedTs ( )
abstract

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

Note 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()

abstract boolean io.agora.rtm.RtmMessage.isOfflineMessage ( )
abstract

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 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 resends it to the receiver when he/she is back online).
  • false: This message has not been cached on the server.