Agora Java API Reference for Android

Public Member Functions | List of all members
io.agora.rtm.StreamChannel Class Referenceabstract

## Public Member Functions
abstract RtmErrorCode | release ()
abstract void | join (JoinChannelOptions options, ResultCallback< Void > resultCallback)
abstract void | renewToken (String token, ResultCallback< Void > resultCallback)
abstract void | leave (ResultCallback< Void > resultCallback)
abstract String | getChannelName ()
abstract void | joinTopic (String topicName, JoinTopicOptions options, ResultCallback< Void > resultCallback)
abstract void | publishTopicMessage (String topicName, byte[] message, TopicMessageOptions options, ResultCallback< Void > resultCallback)
abstract void | publishTopicMessage (String topicName, String message, TopicMessageOptions options, ResultCallback< Void > resultCallback)
abstract void | leaveTopic (String topicName, ResultCallback< Void > resultCallback)
abstract void | subscribeTopic (String topicName, TopicOptions options, ResultCallback< SubscribeTopicResult > resultCallback)
abstract void | unsubscribeTopic (String topicName, TopicOptions options, ResultCallback< Void > resultCallback)
abstract void | getSubscribedUserList (String topicName, ResultCallback< ArrayList< String >> resultCallback)
abstract RtmErrorCode | setParameters (String parameters)

## Detailed Description

The StreamChannel class.

This class provides the stream channel methods that can be invoked by your app.

## Member Function Documentation

## ◆ release()

abstract RtmErrorCode io.agora.rtm.StreamChannel.release | ( |  | ) |
| abstract

Release the stream channel instance.

Returns
  RtmErrorCode

## ◆ join()

abstract void io.agora.rtm.StreamChannel.join | ( | JoinChannelOptions | options,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Join the channel.

Parameters

  options | join channel options.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ renewToken()

abstract void io.agora.rtm.StreamChannel.renewToken | ( | String | token,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Renews the token. Once a token is enabled and used, it expires after a certain period of time. You should generate a new token on your server, call this method to renew it.

Parameters

  token | Token used renew.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ leave()

abstract void io.agora.rtm.StreamChannel.leave | ( | ResultCallback< Void > | resultCallback | ) |
| abstract

Leave the channel.

Parameters

  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ getChannelName()

abstract String io.agora.rtm.StreamChannel.getChannelName | ( |  | ) |
| abstract

Return the channel name of this stream channel.

Returns
  The channel name.

## ◆ joinTopic()

abstract void io.agora.rtm.StreamChannel.joinTopic | ( | String | topicName,
|  | JoinTopicOptions | options,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Join a topic.

Parameters

  topicName | The name of the topic.
  options | The options of the topic.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ publishTopicMessage() [1/2]

abstract void io.agora.rtm.StreamChannel.publishTopicMessage | ( | String | topicName,
|  | byte[] | message,
|  | TopicMessageOptions | options,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Publish a binary message in the topic.

Parameters

  topicName | The name of the topic.
  message | The content of the message.
  options | The options of the message.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ publishTopicMessage() [2/2]

abstract void io.agora.rtm.StreamChannel.publishTopicMessage | ( | String | topicName,
|  | String | message,
|  | TopicMessageOptions | options,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Publish a string message in the topic.

Parameters

  topicName | The name of the topic.
  message | The content of the message.
  options | The options of the message.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ leaveTopic()

abstract void io.agora.rtm.StreamChannel.leaveTopic | ( | String | topicName,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Leave the topic.

Parameters

  topicName | The name of the topic.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ subscribeTopic()

abstract void io.agora.rtm.StreamChannel.subscribeTopic | ( | String | topicName,
|  | TopicOptions | options,
|  | ResultCallback< SubscribeTopicResult > | resultCallback
| ) |  |
| abstract

Subscribe a topic.

Parameters

  topicName | The name of the topic.
  options | The options of subscribe the topic.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ unsubscribeTopic()

abstract void io.agora.rtm.StreamChannel.unsubscribeTopic | ( | String | topicName,
|  | TopicOptions | options,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Unsubscribe a topic.

Parameters

  topicName | The name of the topic.
  options | The options of unsubscribe the topic.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ getSubscribedUserList()

abstract void io.agora.rtm.StreamChannel.getSubscribedUserList | ( | String | topicName,
|  | ResultCallback< ArrayList< String >> | resultCallback
| ) |  |
| abstract

Get subscribed user list

Parameters

  topicName | The name of the topic.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ setParameters()

abstract RtmErrorCode io.agora.rtm.StreamChannel.setParameters | ( | String | parameters | ) |
| abstract

Set parameters of the stream channel

Parameters

  parameters | The parameters in json format

Returns
  RtmErrorCode