Agora RTC Objective-C API Reference Refactor

Public Member Functions
IChannel Class Referenceabstract

## Public Member Functions
virtual int | setEventHandler (IChannelEventHandler *eventHandler, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | join (aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | leave (aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | sendMessage (const IMessage *message, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | updateAttributes (IChannelAttributes *attributes, int64_t &requestId, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | deleteAttributes (IChannelAttributes *attributes, int64_t &requestId, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual const char * | getId () const =0
virtual int | release ()=0

## Detailed Description

The IChannel class.

## Member Function Documentation

## ◆ setEventHandler()

virtual int setEventHandler | ( | IChannelEventHandler * | eventHandler,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Sets an event handler for IChannel.

Parameters

  eventHandler | The pointer to the event handler of IChannel: IChannelEventHandler.

## ◆ join()

virtual int join | ( | aosl_ref_t | ares = `AOSL_REF_INVALID` | ) |
| pure virtual

Joins the current channel.

A successful method call triggers either onJoinSuccess() or onJoinFailure() on the local client, to report the state of joining the channel.

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

## ◆ leave()

virtual int leave | ( | aosl_ref_t | ares = `AOSL_REF_INVALID` | ) |
| pure virtual

Leaves the current channel.

After the local user successfully leaves the channel, the SDK triggers the onLeave() on the local client.

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

## ◆ sendMessage()

virtual int sendMessage | ( | const IMessage * | message,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Sends a channel message.

After you successfully send a channel message, all members in the channel receive the message in the onMessageReceived() callback.

Parameters

  message | The pointer to the channel message that you want to send: IMessage.

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

## ◆ updateAttributes()

virtual int updateAttributes | ( | IChannelAttributes * | attributes,
|  | int64_t & | requestId,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Updates the channel attributes.

A successful method call triggers the onUpdateAttributesResponse() callback on the local client.

Parameters

  attributes | The pointer to the channel attributes that you want to update: IChannelAttributes.
  requestId | ID of the current update request.

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

## ◆ deleteAttributes()

virtual int deleteAttributes | ( | IChannelAttributes * | attributes,
|  | int64_t & | requestId,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Removes the channel attributes.

A successful method call triggers the onDeleteAttributesResponse() callback on the local client.

Parameters

  attributes | The pointer to the channel attributes that you want to remove: IChannelAttributes.
  requestId | ID of the current delete request.

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

## ◆ getId()

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

Gets the current request ID.

Returns
  - The pointer to the request ID, if the method call succeeds.
  - An empty pointer NULL, if the method call fails.

## ◆ release()

virtual int release | ( |  | ) |
| pure virtual

Releases the IChannel instance.

This is a synchronous method call, which means that the SDK reports the result of this method call after the IChannel instance is successfully released.

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