Inherits: : Object
Defined in: : lib/opentok/session.rb
Overview
Represents an OpenTok session.
Use the OpenTok.createSession() method to create an OpenTok session. Use the session_id property of the Session object to get the session ID.
Instance Attribute Summary
#:archive_resolution ⇒ String readonly
The resolution of archives in an auto-archived session.
#archive_mode ⇒ String readonly
Whether the session will be archived automatically (
:always) or not (:manual).#archive_name ⇒ String readonly
The name to use for archives in auto-archived sessions.
#archive_resolution ⇒ Object readonly
Returns the value of attribute archive_resolution.
#e2ee ⇒ Object readonly
Returns the value of attribute e2ee.
#location ⇒ String readonly
The location hint IP address.
#media_mode ⇒ String readonly
Set to :routed if the session uses the OpenTok Media Router or to :relayed if the session attempts to transmit streams directly between clients.
#session_id ⇒ String readonly
The session ID.
Instance Method Summary
#generate_token(options) ⇒ String
Generates a token.
Instance Attribute Details
#:archive_resolution ⇒ String (readonly)
The resolution of archives in an auto-archived session.
Returns:
(String) —
the current value of :archive_resolution
#archive_mode ⇒ String (readonly)
Whether the session will be archived automatically (:always) or not (:manual).
Returns:
(String) —
the current value of archive_mode
#archive_name ⇒ String (readonly)
The name to use for archives in auto-archived sessions.
Returns:
(String) —
the current value of archive_name
#archive_resolution ⇒ Object (readonly)
Returns the value of attribute archive_resolution.
#e2ee ⇒ Object (readonly)
Returns the value of attribute e2ee.
#location ⇒ String (readonly)
The location hint IP address. See the OpenTok.createSession() method.
Returns:
(String) —
the current value of location
#media_mode ⇒ String (readonly)
Set to :routed if the session uses the OpenTok Media Router or to :relayed if the session attempts to transmit streams directly between clients.
Returns:
(String) —
the current value of media_mode
#session_id ⇒ String (readonly)
The session ID.
Returns:
(String) —
the current value of session_id
Instance Method Details
#generate_token(options) ⇒ String
Generates a token.
Parameters:
- options (Hash)
Options Hash (options):
:token_type (String)
—
The type of token to generate. Must be one of ‘T1’ or ‘JWT’. ‘JWT’ is the default.
:role (Symbol)
—
The role for the token. Set this to one of the following values:
: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.):publisheronly– A client connected with a publisheronly token can publish streams but cannot subscribe to streams.:moderator– n 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.
:expire_time (integer)
—
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 (String)
—
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.
:initial_layout_class_list (Array)
—
An array 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.
Returns:
(String) —
The token string.