2018-07-23 12:03:56 +02:00
|
|
|
import { Connection } from './Connection';
|
|
|
|
import { Publisher } from './Publisher';
|
2018-01-27 19:39:49 +01:00
|
|
|
import { SessionProperties } from './SessionProperties';
|
2018-04-23 11:06:16 +02:00
|
|
|
import { TokenOptions } from './TokenOptions';
|
2017-06-10 01:44:31 +02:00
|
|
|
export declare class Session {
|
2018-07-23 12:03:56 +02:00
|
|
|
/**
|
|
|
|
* Unique identifier of the Session
|
|
|
|
*/
|
2018-04-24 15:42:23 +02:00
|
|
|
sessionId: string;
|
2018-07-23 12:03:56 +02:00
|
|
|
/**
|
|
|
|
* Properties defining the session
|
|
|
|
*/
|
2018-04-24 15:42:23 +02:00
|
|
|
properties: SessionProperties;
|
2018-07-23 12:03:56 +02:00
|
|
|
/**
|
|
|
|
* 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]]
|
|
|
|
*/
|
|
|
|
activeConnections: Connection[];
|
|
|
|
/**
|
|
|
|
* Whether the session is being recorded or not
|
|
|
|
*/
|
|
|
|
recording: boolean;
|
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
constructor(propertiesOrJson?: any);
|
2018-04-24 15:42:23 +02:00
|
|
|
/**
|
2018-04-25 17:50:55 +02:00
|
|
|
* Gets the unique identifier of the Session
|
2018-04-24 15:42:23 +02:00
|
|
|
*/
|
2018-04-25 17:50:55 +02:00
|
|
|
getSessionId(): string;
|
2018-04-24 15:42:23 +02:00
|
|
|
/**
|
2018-04-25 17:50:55 +02:00
|
|
|
* Gets a new token associated to Session object
|
2018-04-24 15:42:23 +02:00
|
|
|
*
|
2018-04-25 17:50:55 +02:00
|
|
|
* @returns A Promise that is resolved to the _token_ if success and rejected with an Error object if not
|
2018-04-24 15:42:23 +02:00
|
|
|
*/
|
2018-04-18 10:56:28 +02:00
|
|
|
generateToken(tokenOptions?: TokenOptions): Promise<string>;
|
2018-07-23 12:03:56 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
close(): Promise<any>;
|
|
|
|
/**
|
|
|
|
* 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 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
|
|
|
|
*/
|
|
|
|
fetch(): Promise<boolean>;
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* @returns A Promise that is resolved if the user was successfully disconnected and rejected with an Error object if not
|
|
|
|
*/
|
|
|
|
forceDisconnect(connection: string | Connection): Promise<any>;
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* @returns A Promise that is resolved if the stream was successfully unpublished and rejected with an Error object if not
|
|
|
|
*/
|
|
|
|
forceUnpublish(publisher: string | Publisher): Promise<any>;
|
2018-04-25 17:50:55 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
getSessionIdHttp(): Promise<string>;
|
2018-07-23 12:03:56 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
|
|
|
resetSessionWithJson(json: any): Session;
|
2017-06-10 01:44:31 +02:00
|
|
|
}
|