Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Session

Hierarchy

  • Session

Index

Properties

activeConnections

activeConnections: Connection[] = []

Array containing the active Connections of the Session. It is a subset of Session.connections array containing only those Connections with property Connection.status to active.

To get the array of active Connections with their current actual value, you must call Session.fetch or OpenVidu.fetch before consulting property activeConnections

connections

connections: Connection[] = []

Array of Connections to the Session. This property always initialize as an empty array and will remain unchanged since the last time method Session.fetch or OpenVidu.fetch was called. Exceptions to this rule are:

To get the array of Connections with their current actual value, you must call Session.fetch or OpenVidu.fetch before consulting property connections

createdAt

createdAt: number

Timestamp when this session was created, in UTC milliseconds (ms since Jan 1, 1970, 00:00:00 UTC)

properties

properties: SessionProperties

Properties defining the session

recording

recording: boolean = false

Whether the session is being recorded or not

sessionId

sessionId: string

Unique identifier of the Session

Methods

close

  • close(): Promise<any>
  • Gracefully closes the Session: unpublishes all streams and evicts every participant

    Returns Promise<any>

    A Promise that is resolved if the session has been closed successfully and rejected with an Error object if not

createConnection

  • Creates a new Connection object associated to Session object and configured with connectionProperties. Each user connecting to the Session requires a Connection. The token string value to send to the client side is available at Connection.token.

    Parameters

    Returns Promise<Connection>

    A Promise that is resolved to the generated Connection object if success and rejected with an Error object if not

fetch

  • fetch(): Promise<boolean>

forceDisconnect

  • forceDisconnect(connection: string | Connection): Promise<any>
  • Removes the Connection from the Session. This can translate into a forced eviction of a user from the Session if the Connection had status active or into a token invalidation if no user had taken the Connection yet (status pending).

    In the first case, OpenVidu Browser will trigger the proper events in the client-side (streamDestroyed, connectionDestroyed, sessionDisconnected) with reason set to "forceDisconnectByServer".

    In the second case, the token of the Connection will be invalidated and no user will be able to connect to the session with it.

    This method automatically updates the properties of the local affected objects. This means that there is no need to call Session.fetch or OpenVidu.fetch] to see the changes consequence of the execution of this method applied in the local objects.

    Parameters

    • connection: string | Connection

      The Connection object to remove from the session, or its connectionId property

    Returns Promise<any>

    A Promise that is resolved if the Connection was successfully removed from the Session and rejected with an Error object if not

forceUnpublish

  • forceUnpublish(publisher: string | Publisher): Promise<any>
  • Forces some Connection to unpublish a Stream (identified by its streamId or the corresponding Publisher object owning it). OpenVidu Browser will trigger the proper events on the client-side (streamDestroyed) with reason set to "forceUnpublishByServer".

    You can get publisher parameter from Connection.publishers array (Publisher.streamId for getting each streamId property). Remember to call Session.fetch or OpenVidu.fetch before to fetch the current actual properties of the Session from OpenVidu Server

    This method automatically updates the properties of the local affected objects. This means that there is no need to call Session.fetch or OpenVidu.fetch to see the changes consequence of the execution of this method applied in the local objects.

    Parameters

    • publisher: string | Publisher

      The Publisher object to unpublish, or its streamId property

    Returns Promise<any>

    A Promise that is resolved if the stream was successfully unpublished and rejected with an Error object if not

generateToken

  • generateToken(tokenOptions?: TokenOptions): Promise<string>

updateConnection

Generated using TypeDoc