# How can a host change the role of a remote user? (/en/api-reference/faq/integration/host_set_role)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

In a live interactive streaming channel, the host can invite an audience to take on the role of co-host, or change role back to audience.

You can implement this function by combining the following features:

* Signaling and channel attributes using methods from the Agora Signaling SDK.
* Setting the user role using methods from the Agora Video SDK.

## Implementation [#implementation]

Before proceeding, ensure that you have integrated both the Agora Signaling SDK and Video SDK in your project. For how to integrate these SDKs, see the following guides:

* [Agora Signaling SDK Quickstart](/en/signaling/get-started/sdk-quickstart)
* [Agora Video SDK Quickstart](/en/interactive-live-streaming/get-started/get-started-sdk)

The basic API call sequence is as follows:

![](https://web-cdn.agora.io/docs-files/1585030025387)

Refer to the detailed steps for implementation:

1. The host calls [`sendMessage`](https://api-ref.agora.io/en/signaling-sdk/android/1.x/classio_1_1agora_1_1rtm_1_1_rtm_channel.html#a57087adf4227a17c774ea292840148a0) to send a peer-to-peer message that invites an audience to take on the role of co-host.
2. The audience receives the invitation message in the [`onMessageReceived`](https://api-ref.agora.io/en/signaling-sdk/android/1.x/interfaceio_1_1agora_1_1rtm_1_1_rtm_client_listener.html#af760814981718fb31d88acb8251d19b6) callback.
3. The audience calls [`setClientRole`](https://api-ref.agora.io/en/video-sdk/android/4.x/API/class_irtcengine.html#api_irtcengine_setclientrole) to change the user role to `CLIENT_ROLE_BROADCASTER`.
4. After successfully changing the user role, the audience receives the `onClientRoleChanged` callback, and becomes a co-host.
5. The new co-host calls [`addOrUpdateChannelAttributes`](https://api-ref.agora.io/en/signaling-sdk/android/1.x/classio_1_1agora_1_1rtm_1_1_rtm_client.html#a997a31e6bfe1edc9b6ef58a931ef3f23) to notify the role change to all users in the channel.
6. The host receives the [`onAttributesUpdated`](https://api-ref.agora.io/en/signaling-sdk/android/1.x/interfaceio_1_1agora_1_1rtm_1_1_rtm_channel_listener.html#a2904a1f1f78c497b9176fffb853be96f) callback, and starts co-hosting with the new co-host.

To change a co-host back to an audience, follow the same steps, except when calling `setClientRole`, set the user role as `CLIENT_ROLE_AUDIENCE`.

## Relative methods in different programming languages [#relative-methods-in-different-programming-languages]

The methods mentioned in this article are in Java. Refer to the following table if you are programming in a different language:

| Java/C++                       | Objective-C                    | JavaScript                         |
| ------------------------------ | ------------------------------ | ---------------------------------- |
| `sendMessageToPeer`            | `sendMessage`                  | `sendMessage`                      |
| `onMessageReceived`            | `messageReceived`              | `MessageFromPeer`                  |
| `setClientRole`                | `setClientRole`                | `setClientRole`                    |
| `onClientRoleChanged`          | `didClientRoleChanged`         | `Client.on("client-role-changed")` |
| `addOrUpdateChannelAttributes` | `addOrUpdateChannelAttributes` | `addOrUpdateChannelAttributes`     |
| `onAttributesUpdated`          | `attributeUpdate`              | `AttributesUpdated`                |
