Package io.agora.rtm
Class StreamChannel
java.lang.Object
io.agora.rtm.StreamChannel
The StreamChannel class.
This class provides the stream channel methods that can be invoked by your
app.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringReturn the channel name of this stream channel.abstract voidgetSubscribedUserList(String topicName, ResultCallback<ArrayList<String>> resultCallback) Get subscribed user listabstract voidjoin(JoinChannelOptions options, ResultCallback<Void> resultCallback) Join the channel.abstract voidjoinTopic(String topicName, JoinTopicOptions options, ResultCallback<Void> resultCallback) Join a topic.abstract voidleave(ResultCallback<Void> resultCallback) Leave the channel.abstract voidleaveTopic(String topicName, ResultCallback<Void> resultCallback) Leave the topic.abstract voidpublishTopicMessage(String topicName, byte[] message, TopicMessageOptions options, ResultCallback<Void> resultCallback) Publish a binary message in the topic.abstract voidpublishTopicMessage(String topicName, String message, TopicMessageOptions options, ResultCallback<Void> resultCallback) Publish a string message in the topic.abstract RtmConstants.RtmErrorCoderelease()Release the stream channel instance.abstract voidrenewToken(String token, ResultCallback<Void> resultCallback) Renews the token.abstract RtmConstants.RtmErrorCodesetParameters(String parameters) Set parameters of the stream channelabstract voidsubscribeTopic(String topicName, TopicOptions options, ResultCallback<SubscribeTopicResult> resultCallback) Subscribe a topic.abstract voidunsubscribeTopic(String topicName, TopicOptions options, ResultCallback<Void> resultCallback) Unsubscribe a topic.
-
Constructor Details
-
StreamChannel
public StreamChannel()
-
-
Method Details
-
release
Release the stream channel instance.- Returns:
RtmErrorCode
-
join
Join the channel.- Parameters:
options- join channel options.resultCallback- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
renewToken
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- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
leave
Leave the channel.- Parameters:
resultCallback- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
getChannelName
Return the channel name of this stream channel.- Returns:
- The channel name.
-
joinTopic
public abstract void joinTopic(String topicName, JoinTopicOptions options, ResultCallback<Void> resultCallback) Join a topic.- Parameters:
topicName- The name of the topic.options- The options of the topic.resultCallback- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
publishTopicMessage
public abstract void publishTopicMessage(String topicName, byte[] message, TopicMessageOptions options, ResultCallback<Void> resultCallback) 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- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
publishTopicMessage
public abstract void publishTopicMessage(String topicName, String message, TopicMessageOptions options, ResultCallback<Void> resultCallback) 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- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
leaveTopic
Leave the topic.- Parameters:
topicName- The name of the topic.resultCallback- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
subscribeTopic
public abstract void subscribeTopic(String topicName, TopicOptions options, ResultCallback<SubscribeTopicResult> resultCallback) Subscribe a topic.- Parameters:
topicName- The name of the topic.options- The options of subscribe the topic.resultCallback- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
unsubscribeTopic
public abstract void unsubscribeTopic(String topicName, TopicOptions options, ResultCallback<Void> resultCallback) Unsubscribe a topic.- Parameters:
topicName- The name of the topic.options- The options of unsubscribe the topic.resultCallback- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
getSubscribedUserList
public abstract void getSubscribedUserList(String topicName, ResultCallback<ArrayList<String>> resultCallback) Get subscribed user list- Parameters:
topicName- The name of the topic.resultCallback- AResultCallbackobject. - Success: will receives theResultCallback.onSuccess(Object)callback. - Failure: will receives theResultCallback.onFailure(ErrorInfo)callback.
-
setParameters
Set parameters of the stream channel- Parameters:
parameters- The parameters in json format- Returns:
RtmErrorCode
-