All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.agora.rtm.JoinChannelOptions Maven / Gradle / Ivy

package io.agora.rtm;

import io.agora.common.internal.CalledByNative;

/**
 * Join channel options.
 */
public class JoinChannelOptions {
  /**
   * Token used to join channel.
   */
  private String token = "";

  /**
   * Whether to subscribe channel with user presence
   */
  private boolean withPresence;

  /**
   * Whether to subscribe channel metadata information
   */
  private boolean withMetadata;

  /**
   * Whether to subscribe channel with lock
   */
  private boolean withLock;

  /**
   * Creates a new instance of {@code JoinChannelOptions} with default options.
   */
  public JoinChannelOptions() {
    this.withPresence = true;
    this.withMetadata = false;
    this.withLock = false;
  }

  /**
   * Creates a new instance of {@code JoinChannelOptions} with specifies options.
   *
   * @param token        The token used for authentication
   * @param withPresence Indicates whether subscribe presence event notify
   * @param withMetadata Indicates whether subscribe storage event notify
   * @param withLock     Indicates whether subscribe lock event notify
   */
  public JoinChannelOptions(
      String token, boolean withPresence, boolean withMetadata, boolean withLock) {
    this.token = token;
    this.withPresence = withPresence;
    this.withMetadata = withMetadata;
    this.withLock = withLock;
  }

  public void setToken(String token) {
    this.token = token;
  }

  public void setWithPresence(boolean withPresence) {
    this.withPresence = withPresence;
  }

  public void setWithMetadata(boolean withMetadata) {
    this.withMetadata = withMetadata;
  }

  public void setWithLock(boolean withLock) {
    this.withLock = withLock;
  }

  @CalledByNative
  public String getToken() {
    return this.token;
  }

  @CalledByNative
  public boolean getWithMetadata() {
    return this.withMetadata;
  }

  @CalledByNative
  public boolean getWithPresence() {
    return this.withPresence;
  }

  @CalledByNative
  public boolean getWithLock() {
    return this.withLock;
  }

  @Override
  public String toString() {
    return "JoinChannelOptions {token: " + token + ", withPresence: " + withPresence
        + ", withMetadata: " + withMetadata + ", withLock: " + withLock + "}";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy