openvidu-node-client: createdAt property

pull/121/head
pabloFuente 2018-09-06 12:02:07 +02:00
parent 332877de10
commit b69fbdac54
2 changed files with 25 additions and 2 deletions

View File

@ -28,6 +28,11 @@ export class Connection {
*/
connectionId: string;
/**
* Timestamp when this connection was established, in UTC milliseconds (ms since Jan 1, 1970, 00:00:00 UTC)
*/
createdAt: number;
/**
* Role of the connection
*/
@ -74,9 +79,10 @@ export class Connection {
/**
* @hidden
*/
constructor(connectionId: string, role: OpenViduRole, token: string, location: string, platform: string, serverData: string, clientData: string,
constructor(connectionId: string, createdAt: number, role: OpenViduRole, token: string, location: string, platform: string, serverData: string, clientData: string,
publishers: Publisher[], subscribers: string[]) {
this.connectionId = connectionId;
this.createdAt = createdAt;
this.role = role;
this.token = token;
this.location = location;

View File

@ -34,6 +34,11 @@ export class Session {
*/
sessionId: string;
/**
* Timestamp when this session was created, in UTC milliseconds (ms since Jan 1, 1970, 00:00:00 UTC)
*/
createdAt: number;
/**
* Properties defining the session
*/
@ -388,6 +393,7 @@ export class Session {
if (res.status === 200) {
// SUCCESS response from openvidu-server. Resolve token
this.sessionId = res.data.id;
this.createdAt = res.data.createdAt;
resolve(this.sessionId);
} else {
// ERROR response from openvidu-server. Resolve HTTP status
@ -452,7 +458,18 @@ export class Session {
connection.subscribers.forEach(subscriber => {
subscribers.push(subscriber.streamId);
});
this.activeConnections.push(new Connection(connection.connectionId, connection.role, connection.token, connection.location, connection.platform, connection.serverData, connection.clientData, publishers, subscribers));
this.activeConnections.push(
new Connection(
connection.connectionId,
connection.createdAt,
connection.role,
connection.token,
connection.location,
connection.platform,
connection.serverData,
connection.clientData,
publishers,
subscribers));
});
return this;
}