Hierarchy

  • Session

Properties

activeConnections: Connection[] = []

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

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

broadcasting: boolean = false

Whether the session is being broadcasted or not

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 fetch or fetch was called. Exceptions to this rule are:

  • Calling createConnection automatically adds the new Connection object to the local collection.
  • Calling forceUnpublish automatically updates each affected local Connection object.
  • Calling forceDisconnect automatically updates each affected local Connection object.
  • Calling updateConnection automatically updates the attributes of the affected local Connection object.

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

createdAt: number

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

properties: SessionProperties

Properties defining the session

recording: boolean = false

Whether the session is being recorded or not

sessionId: string

Unique identifier of the Session

Methods

  • Gracefully closes the Session: unpublishes all streams and evicts every participant

    Returns

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

    Returns Promise<void>

  • 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 token.

    Returns

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

    Parameters

    Returns Promise<Connection>

  • Updates every property of the Session with the current status it has in OpenVidu Server. This is especially useful for accessing the list of Connections of the Session (connections, activeConnections) and use those values to call forceDisconnect, forceUnpublish or updateConnection.

    To update all Session objects owned by OpenVidu object at once, call fetch

    Returns

    A promise resolved to true if the Session status has changed with respect to the server, or to false if not. This applies to any property or sub-property of the Session object

    Returns Promise<boolean>

  • 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 fetch or fetch] to see the changes consequence of the execution of this method applied in the local objects.

    Returns

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

    Parameters

    • connection: string | Connection

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

    Returns Promise<void>

  • 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 publishers array (streamId for getting each streamId property). Remember to call fetch or 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 fetch or fetch to see the changes consequence of the execution of this method applied in the local objects.

    Returns

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

    Parameters

    • publisher: string | Publisher

      The Publisher object to unpublish, or its streamId property

    Returns Promise<void>

Generated using TypeDoc