Agora C++ API Reference for All Platforms

Classes | Enumerations
agora::rtm Namespace Reference

## Classes
class | IChannel
class | IChannelAttributes
class | IChannelEventHandler
class | IChannelMember
class | IMessage
class | IRtmService
class | IRtmServiceEventHandler

## Enumerations
enum | PEER_MESSAGE_STATE { PEER_MESSAGE_INIT = 0, PEER_MESSAGE_FAILURE = 1, PEER_MESSAGE_PEER_UNREACHABLE = 2, PEER_MESSAGE_RECEIVED_BY_PEER = 3, PEER_MESSAGE_SENT_TIMEOUT = 4 }
enum | LOGIN_ERR_CODE { LOGIN_ERR_OK = 0, LOGIN_ERR_UNKNOWN = 1, LOGIN_ERR_REJECTED = 2, LOGIN_ERR_INVALID_ARGUMENT = 3, LOGIN_ERR_INVALID_APP_ID = 4, LOGIN_ERR_INVALID_TOKEN = 5, LOGIN_ERR_TOKEN_EXPIRED = 6, LOGIN_ERR_NOT_AUTHORIZED = 7, LOGIN_ERR_TIMEOUT = 8 }
enum | LOGOUT_ERR_CODE { LOGOUT_ERR_OK = 0, LOGOUT_ERR_REJECTED = 1 }
enum | CONNECTION_STATE { CONNECTION_STATE_CONNECTED = 1, CONNECTION_STATE_DISCONNECTED = 2, CONNECTION_STATE_ABORTED = 3 }
enum | CHANNEL_MESSAGE_STATE { CHANNEL_MESSAGE_RECEIVED_BY_SERVER = 1, CHANNEL_MESSAGE_SENT_TIMEOUT = 3 }
enum | JOIN_CHANNEL_ERR { JOIN_CHANNEL_ERR_OK = 0, JOIN_CHANNEL_ERR_FAILURE = 1, JOIN_CHANNEL_ERR_REJECTED = 2, JOIN_CHANNEL_ERR_INVALID_ARGUMENT = 3, JOIN_CHANNEL_TIMEOUT = 4, JOIN_CHANNEL_ERR_EXCEED_LIMIT = 5, JOIN_CHANNEL_ERR_ALREADY_JOINED = 6, JOIN_CHANNEL_ERR_TOO_OFTEN = 7, JOIN_CHANNEL_ERR_JOIN_SAME_CHANNEL_TOO_OFTEN = 8, JOIN_CHANNEL_ERR_NOT_INITIALIZED = 101, JOIN_CHANNEL_ERR_USER_NOT_LOGGED_IN = 102 }
enum | LEAVE_CHANNEL_ERR { LEAVE_CHANNEL_ERR_OK = 0, LEAVE_CHANNEL_ERR_FAILURE = 1, LEAVE_CHANNEL_ERR_REJECTED = 2, LEAVE_CHANNEL_ERR_NOT_IN_CHANNEL = 3, LEAVE_CHANNEL_ERR_NOT_INITIALIZED = 101, LEAVE_CHANNEL_ERR_USER_NOT_LOGGED_IN = 102 }
enum | LEAVE_CHANNEL_REASON { LEAVE_CHANNEL_REASON_QUIT = 1, LEAVE_CHANNEL_REASON_KICKED = 2 }
enum | CHANNEL_MESSAGE_ERR_CODE { CHANNEL_MESSAGE_ERR_OK = 0, CHANNEL_MESSAGE_ERR_FAILURE = 1, CHANNEL_MESSAGE_ERR_SENT_TIMEOUT = 2, CHANNEL_MESSAGE_ERR_TOO_OFTEN = 3, CHANNEL_MESSAGE_ERR_INVALID_MESSAGE = 4, CHANNEL_MESSAGE_ERR_NOT_INITIALIZED = 101, CHANNEL_MESSAGE_ERR_USER_NOT_LOGGED_IN = 102 }
enum | RESPONSE_CODE { RESPONSE_CODE_SUCCESS = 1, RESPONSE_CODE_FAILURE = 2 }
enum | MESSAGE_TYPE { MESSAGE_TYPE_UNDEFINED = 0, MESSAGE_TYPE_TEXT = 1, MESSAGE_TYPE_BINARY = 2, MESSAGE_TYPE_CONVERGE = 4 }

## Enumeration Type Documentation

## ◆ PEER_MESSAGE_STATE

enum agora::rtm::PEER_MESSAGE_STATE

Enumerator
PEER_MESSAGE_INIT |
PEER_MESSAGE_FAILURE |
PEER_MESSAGE_PEER_UNREACHABLE |
PEER_MESSAGE_RECEIVED_BY_PEER |
PEER_MESSAGE_SENT_TIMEOUT |

## ◆ LOGIN_ERR_CODE

enum agora::rtm::LOGIN_ERR_CODE

The login error code.

Enumerator
LOGIN_ERR_OK | 0: Login succeeds. No error occurs.
LOGIN_ERR_UNKNOWN | 1: Login fails for reasons unknown.
LOGIN_ERR_REJECTED | 2: The server rejects the login, either because the user has already logged in, or because the RTM service is not initialized.
LOGIN_ERR_INVALID_ARGUMENT | 3: Invalid login arguments.
LOGIN_ERR_INVALID_APP_ID | 4: The App ID is invalid.
LOGIN_ERR_INVALID_TOKEN | 5: The token is invalid.
LOGIN_ERR_TOKEN_EXPIRED | 6: The login is rejected because the token has expired.
LOGIN_ERR_NOT_AUTHORIZED | 7: Authentication of the RTMP token fails.
LOGIN_ERR_TIMEOUT | 8: The login times out. The current timeout is set as six seconds.

## ◆ LOGOUT_ERR_CODE

enum agora::rtm::LOGOUT_ERR_CODE

The logout error code.

Enumerator
LOGOUT_ERR_OK | 0: Logout succeeds. No error occurs.
LOGOUT_ERR_REJECTED | 1: Logout fails.

## ◆ CONNECTION_STATE

enum agora::rtm::CONNECTION_STATE

The connection state.

Enumerator
CONNECTION_STATE_CONNECTED | 1: The SDK has logged in the RTM service.
CONNECTION_STATE_DISCONNECTED | 2: The initial state. The SDK is disconnected from the RTM service.
CONNECTION_STATE_ABORTED | 3: The SDK gives up logging in the RTM service, mainly because another instance has logged in the RTM service with the same user ID. Call the logout() method before calling login to log in the RTM service again.

## ◆ CHANNEL_MESSAGE_STATE

enum agora::rtm::CHANNEL_MESSAGE_STATE

The state of the channel message.

Enumerator
CHANNEL_MESSAGE_RECEIVED_BY_SERVER | 1: The channel message is received by the server.
CHANNEL_MESSAGE_SENT_TIMEOUT | 3: The SDK has not received a response from the server in five seconds. The current timeout is set as five seconds.

## ◆ JOIN_CHANNEL_ERR

enum agora::rtm::JOIN_CHANNEL_ERR

The join channel error.

Enumerator
JOIN_CHANNEL_ERR_OK | 0: The method call succeeds, or the user joins the channel successfully.
JOIN_CHANNEL_ERR_FAILURE | 1: Common failure. The user fails to join the channel.
JOIN_CHANNEL_ERR_REJECTED | 2: RESERVED FOR FUTURE USE
JOIN_CHANNEL_ERR_INVALID_ARGUMENT | 3: The user fails to join the channel because the argument is invalid.
JOIN_CHANNEL_TIMEOUT | 4: A timeout occurs when joining the channel. The current timeout is set as five seconds. Possible reasons: The user is in the CONNECTION_STATE_ABORTED state.
JOIN_CHANNEL_ERR_EXCEED_LIMIT | 5: The number of the RTM channels you are in exceeds the limit of 20.
JOIN_CHANNEL_ERR_ALREADY_JOINED | 6: The user is joining or has joined the channel.
JOIN_CHANNEL_ERR_TOO_OFTEN | 7: The method call frequency exceeds 50 queries every three seconds.
JOIN_CHANNEL_ERR_JOIN_SAME_CHANNEL_TOO_OFTEN | 8: The frequency of joining the same channel exceeds two times every five seconds.
JOIN_CHANNEL_ERR_NOT_INITIALIZED | 101: IRtmService is not initialized.
JOIN_CHANNEL_ERR_USER_NOT_LOGGED_IN | 102: The user does not call the login method, or the method call of login does not succeed before joining the channel.

## ◆ LEAVE_CHANNEL_ERR

enum agora::rtm::LEAVE_CHANNEL_ERR

Error codes related to leaving a channel.

Enumerator
LEAVE_CHANNEL_ERR_OK | 0: The method call succeeds, or the user leaves the channel successfully.
LEAVE_CHANNEL_ERR_FAILURE | 1: Common failure. The user fails to leave the channel.
LEAVE_CHANNEL_ERR_REJECTED | 2: RESERVED FOR FUTURE USE
LEAVE_CHANNEL_ERR_NOT_IN_CHANNEL | 3: The user is not in the channel.
LEAVE_CHANNEL_ERR_NOT_INITIALIZED | 101: IRtmService is not initialized.
LEAVE_CHANNEL_ERR_USER_NOT_LOGGED_IN | 102: The user does not call the login method, or the method call of login does not succeed before calling the leave method.

## ◆ LEAVE_CHANNEL_REASON

enum agora::rtm::LEAVE_CHANNEL_REASON

The reason for a user to leave the channel.

Enumerator
LEAVE_CHANNEL_REASON_QUIT | 1: The user quits the channel.
LEAVE_CHANNEL_REASON_KICKED | 2: The user is kicked off the channel.

## ◆ CHANNEL_MESSAGE_ERR_CODE

enum agora::rtm::CHANNEL_MESSAGE_ERR_CODE

Error codes related to sending a channel message.

Enumerator
CHANNEL_MESSAGE_ERR_OK | 0: The method call succeeds, or the server receives the channel message.
CHANNEL_MESSAGE_ERR_FAILURE | 1: Common failure. The user fails to send the channel message.
CHANNEL_MESSAGE_ERR_SENT_TIMEOUT | 2: The SDK does not receive a response from the server in 10 seconds. The current timeout is set as 10 seconds. Possible reasons: The user is in the CONNECTION_STATE_ABORTED state.
CHANNEL_MESSAGE_ERR_TOO_OFTEN | 3: The method call frequency exceeds the limit of (RTM SDK for Windows C++) 180 calls every three seconds or (RTM SDK for Linux C++) 1500 calls every three seconds, with channel and peer messages taken together..
CHANNEL_MESSAGE_ERR_INVALID_MESSAGE | 4: The message is null or exceeds 32 KB in length.
CHANNEL_MESSAGE_ERR_NOT_INITIALIZED | 101: IRtmService is not initialized.
CHANNEL_MESSAGE_ERR_USER_NOT_LOGGED_IN | 102: The user does not call the login method, or the method call of login does not succeed before sending out a channel message.

## ◆ RESPONSE_CODE

enum agora::rtm::RESPONSE_CODE

The response code.

Enumerator
RESPONSE_CODE_SUCCESS | 1: The response
RESPONSE_CODE_FAILURE |

## ◆ MESSAGE_TYPE

enum agora::rtm::MESSAGE_TYPE

The message type.

Enumerator
MESSAGE_TYPE_UNDEFINED | 0: The message type is undefined.
MESSAGE_TYPE_TEXT | 1: A text message.
MESSAGE_TYPE_BINARY | 2: A raw message in binary, for example, audio data, or video data.
MESSAGE_TYPE_CONVERGE | 4: A converge message.