Skip to main content

Stream channels

Stream Channels are based on the room model. In a stream channel, users join a topic in order to send message to all users subscribed to that topic. Signaling enables each user to join up to one hundred channels at the same time. Each channel can have unlimited topics and up to 128 simultaneous users. Topics have a higher message transmission rate, greater message concurrency capability, and enable synchronous transmission of audio and video data. You use topics for Metaverse, AR/VR, interactive games, real-time collaboration, and parallel manipulation app.

Understand the tech

The following figure shows the stream channel workflow:

Stream channel

Prerequisites

To follow this page, you must have:

Implement communication in a stream channel

This section shows how to use the Signaling SDK to implement stream channels and presence in your app.

  1. Set Signaling SDK to connect to Cloud Proxy before you join a channel

    To access Agora SD-RTN™ in a restricted network environment, call setCloudProxy and pass 0 as a parameter to select the automatic mode for transmission. The setCloudProxy method returns 0 upon successful initiation of cloud proxy service.

    To enable the Cloud Proxy service in your app, in /app/java/com.example.<projectname>/MainActivity, add the following code after agoraEngine = RtcEngine.create(config);:


    _7
    // Start cloud proxy service and set automatic transmission mode.
    _7
    int proxyStatus = agoraEngine.setCloudProxy(0);
    _7
    if (proxyStatus == 0) {
    _7
    showMessage("Proxy service started successfully");
    _7
    } else {
    _7
    showMessage("Proxy service failed with error :" + proxyStatus);
    _7
    }

Test stream channels

To test this functionality:

  1. Set the APP ID

    In agora-manager/res/raw/config.json, set appId to the AppID of your project.

  2. Set the authentication method

    Choose one of the following authentication methods:

    • Temporary token:
      1. Set rtcToken with the value of your temporary token.
      2. Set channelName - with the name of a channel you used to create the token.
    • Authentication server:
      1. Setup an Authentication server
      2. In config.json, set:
        • channelName with the name of a channel you want to join.
        • rtcToken to an empty string.
        • serverUrl to the base URL of your authentication server. For example, https://agora-token-service-production-1234.up.railway.app.
  3. Start the Android reference app

    1. In Android Studio, connect a physical Android device to your development machine.

    2. Click Run to start the app.

      A moment later you see the project installed on your device. If this is the first time you run the project, you need to grant microphone and camera access to your app.

  1. In Android Studio, open app/java/com.example.<projectname>/MainActivity, and update appId, channelName and token with the values for your temporary token.

  2. Connect a physical Android device to your development device.

  3. In Android Studio, click Run app. A moment later you see the project installed on your device.

    If this is the first time you run the project, grant microphone and camera access to your app.

  1. Click Join to start a call.

You see your app starts the proxy service and magically connects to the Agora SD-RTN™ which was not possible in a restricted network environment.

Reference

This section contains information that completes the information in this page, or points you to documentation that explains other aspects to this product.

Signaling