### Hierarchy

- Session

## Index

### Properties

- activeConnections
- properties
- recording
- sessionId

### Methods

- close
- fetch
- forceDisconnect
- forceUnpublish
- generateToken
- getSessionId

## Properties

### activeConnections

activeConnections: Connection[] = []

- Defined in Session.ts:52

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

- Calling Session.forceUnpublish also automatically updates each affected Connection status
- Calling Session.forceDisconnect automatically updates each affected Connection status

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

### properties

properties: SessionProperties

- Defined in Session.ts:40

Properties defining the session

### recording

recording: boolean = false

- Defined in Session.ts:57

Whether the session is being recorded or not

### sessionId

sessionId: string

- Defined in Session.ts:35

Unique identifier of the Session

## Methods

### close

- close(): Promise<any>

- - Defined in Session.ts:142

  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

### fetch

- fetch(): Promise<boolean>

- - Defined in Session.ts:187

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

  #### Returns Promise<boolean>

  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

### forceDisconnect

- forceDisconnect(connection: string | Connection): Promise<any>

- - Defined in Session.ts:237

  Forces the user with Connection `connectionId` to leave the session. OpenVidu Browser will trigger the proper events on the client-side (`streamDestroyed`, `connectionDestroyed`, `sessionDisconnected`) with reason set to `"forceDisconnectByServer"`

  You can get `connection` parameter from Session.activeConnections array (Connection.connectionId for getting each `connectionId` property). Remember to call Session.fetch before to fetch the current actual properties of the Session from OpenVidu Server

  #### Parameters

  - ##### connection: string | Connection

  #### Returns Promise<any>

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

### forceUnpublish

- forceUnpublish(publisher: string | Publisher): Promise<any>

- - Defined in Session.ts:304

  Forces some user 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 before to fetch the current actual properties of the Session from OpenVidu Server

  #### Parameters

  - ##### publisher: string | Publisher

  #### 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>

- - Defined in Session.ts:93

  Gets a new token associated to Session object

  #### Parameters

  - ##### Optional tokenOptions: TokenOptions

  #### Returns Promise<string>

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

### getSessionId

- getSessionId(): string

- - Defined in Session.ts:84

  Gets the unique identifier of the Session

  #### Returns string

Generated using TypeDoc