java.lang.Object

com.opentok.TokenOptions.Builder

Enclosing class: : TokenOptions


public static class TokenOptions.Builder extends Object

Use this class to create a TokenOptions object.

See Also: : - TokenOptions

Constructor Summary

Constructors

Constructor

Description

Builder()

Method Summary

All MethodsInstance MethodsConcrete Methods

Modifier and Type

Method

Description

TokenOptions

build()

Builds the TokenOptions object.

TokenOptions.Builder

data(String data)

A string containing connection metadata describing the end-user.

TokenOptions.Builder

expireTime(long expireTime)

Sets the expiration time for the token.

TokenOptions.Builder

initialLayoutClassList(List<String> initialLayoutClassList)

A List of class names (strings) to be used as the initial layout classes for streams published by the client.

TokenOptions.Builder

role(Role role)

Sets the role for the token.

TokenOptions.Builder

useLegacyT1Token()

Use this method to generate a legacy T1 token instead of a JWT.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

Builder

public Builder()

Method Details

role

public TokenOptions.Builder role(Role role)

Sets the role for the token. Each role defines a set of permissions granted to the token.

Parameters: : role - The role for the token. Valid values are defined in the Role class:

- `SUBSCRIBER` — A subscriber can only subscribe to streams.
- `PUBLISHER` — A publisher can publish streams, subscribe to
  streams, and signal. (This is the default value if you do not specify a role.)
- `MODERATOR` — In addition to the privileges granted to a
  publisher, a moderator can perform moderation functions, such as forcing clients to
  disconnect, to stop publishing streams, or to mute audio in published streams. See the
  [Moderation developer guide](https://tokbox.com/developer/guides/moderation/).

expireTime

public TokenOptions.Builder expireTime(long expireTime)

Sets the expiration time for the token.

Parameters: : expireTime - The expiration time, in seconds since the UNIX epoch. Pass in 0 to use the default expiration time of 24 hours after the token creation time. The maximum expiration time is 30 days after the creation time.

data

public TokenOptions.Builder data(String data) throws InvalidArgumentException

A string containing connection metadata describing the end-user. For example, you can pass the user ID, name, or other data describing the end-user. The length of the string is limited to 1000 characters. This data cannot be updated once it is set.

Parameters: : data - The connection metadata.

Throws: : InvalidArgumentException

initialLayoutClassList

public TokenOptions.Builder initialLayoutClassList(List<String> initialLayoutClassList)

A List of class names (strings) to be used as the initial layout classes for streams published by the client. Layout classes are used in customizing the layout of videos in live streaming broadcasts and composed archives.

Parameters: : initialLayoutClassList - The initial layout class list.

useLegacyT1Token

public TokenOptions.Builder useLegacyT1Token()

Use this method to generate a legacy T1 token instead of a JWT.

Returns: : This builder.

Since: : 4.15.0

build

public TokenOptions build()

Builds the TokenOptions object.

Returns: : The TokenOptions object.