io.agora.rtm.StreamChannel Maven / Gradle / Ivy
package io.agora.rtm;
import io.agora.rtm.JoinChannelOptions;
import io.agora.rtm.JoinTopicOptions;
import io.agora.rtm.ResultCallback;
import io.agora.rtm.RtmConstants.RtmErrorCode;
import io.agora.rtm.TopicMessageOptions;
import io.agora.rtm.TopicOptions;
import java.util.ArrayList;
/**
* The StreamChannel class.
*
* This class provides the stream channel methods that can be invoked by your
* app.
*/
public abstract class StreamChannel {
/**
* Release the stream channel instance.
*
* @return {@code RtmErrorCode}
*/
public abstract RtmErrorCode release();
/**
* Join the channel.
*
* @param options join channel options.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void join(JoinChannelOptions options, ResultCallback resultCallback);
/**
* 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.
*
* @param token Token used renew.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void renewToken(String token, ResultCallback resultCallback);
/**
* Leave the channel.
*
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void leave(ResultCallback resultCallback);
/**
* Return the channel name of this stream channel.
*
* @return The channel name.
*/
public abstract String getChannelName();
/**
* Join a topic.
*
* @param topicName The name of the topic.
* @param options The options of the topic.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void joinTopic(
String topicName, JoinTopicOptions options, ResultCallback resultCallback);
/**
* Publish a binary message in the topic.
*
* @param topicName The name of the topic.
* @param message The content of the message.
* @param option The option of the message.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void publishTopicMessage(String topicName, byte[] message,
TopicMessageOptions options, ResultCallback resultCallback);
/**
* Publish a string message in the topic.
*
* @param topicName The name of the topic.
* @param message The content of the message.
* @param option The option of the message.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void publishTopicMessage(String topicName, String message,
TopicMessageOptions options, ResultCallback resultCallback);
/**
* Leave the topic.
*
* @param topicName The name of the topic.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void leaveTopic(String topicName, ResultCallback resultCallback);
/**
* Subscribe a topic.
*
* @param topicName The name of the topic.
* @param options The options of subscribe the topic.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void subscribeTopic(
String topicName, TopicOptions options, ResultCallback resultCallback);
/**
* Unsubscribe a topic.
*
* @param topicName The name of the topic.
* @param options The options of unsubscribe the topic.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void unsubscribeTopic(
String topicName, TopicOptions options, ResultCallback resultCallback);
/**
* Get subscribed user list
*
* @param topicName The name of the topic.
* @param resultCallback A {@link ResultCallback} object.
* - Success: will receives the
* {@link ResultCallback.onSuccess()} callback.
* - Failure: will receives the
* {@link ResultCallback.onFailure()} callback.
*/
public abstract void getSubscribedUserList(
String topicName, ResultCallback> resultCallback);
}