Agora RTC Objective-C API Reference Refactor

Public Member Functions | Static Public Member Functions
IMessage Class Referenceabstract

## Public Member Functions
virtual int64_t | getMessageId () const =0
virtual int | getMessageType () const =0
virtual void | setText (const char *str)=0
virtual const char * | getText () const =0
virtual const unsigned char * | getRawMessageData () const =0
virtual int | getRawMessageLength () const =0
virtual void | setMessageType (int32_t type)=0
virtual void | setRawMessage (const uint8_t *data, int length)=0
virtual void | release ()=0

## Static Public Member Functions
static IMessage * | createMessage ()

## Detailed Description

The IMessage class.

## Constructor & Destructor Documentation

## ◆ ~IMessage()

virtual ~IMessage | ( |  | ) |
| inline virtual

## Member Function Documentation

## ◆ createMessage()

static IMessage* createMessage | ( |  | ) |
| static

Creates an IMessage instance.

The created IMessage instance can be either for a channel message or for a peer-to-peer message.

You can set the content of the text message later using the setText() method.

Returns
  - An empty text IMessage instance, if the method call succeeds.

## ◆ getMessageId()

virtual int64_t getMessageId | ( |  | ) | const
| pure virtual

Gets the ID of the message.

Returns
  The ID of the current IMessage instance.

## ◆ getMessageType()

virtual int getMessageType | ( |  | ) | const
| pure virtual

Gets the message type.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setText()

virtual void setText | ( | const char * | str | ) |
| pure virtual

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

Parameters

  str | The content of the text message, or the text description of the raw message. The maximum length is 32 KB.

## ◆ getText()

virtual const char* getText | ( |  | ) | const
| pure virtual

Gets the content of the text messsage, or the text description of the raw message.

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

## ◆ getRawMessageData()

virtual const unsigned char* getRawMessageData | ( |  | ) | const
| pure virtual

Get pointer of custom raw message

Returns
  - The content of binary raw message

## ◆ getRawMessageLength()

virtual int getRawMessageLength | ( |  | ) | const
| pure virtual

Get length of custom raw message

Returns
  - The length of binary raw message in bytes

## ◆ setMessageType()

virtual void setMessageType | ( | int32_t | type | ) |
| pure virtual

Set message type

## ◆ setRawMessage()

virtual void setRawMessage | ( | const uint8_t * | data,
|  | int | length
| ) |  |
| pure virtual

Set raw binary message

## ◆ release()

virtual void release | ( |  | ) |
| pure virtual

Releases the IMessage instance.