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; 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 * Role of the connection
*/ */
@ -74,9 +79,10 @@ export class Connection {
/** /**
* @hidden * @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[]) { publishers: Publisher[], subscribers: string[]) {
this.connectionId = connectionId; this.connectionId = connectionId;
this.createdAt = createdAt;
this.role = role; this.role = role;
this.token = token; this.token = token;
this.location = location; this.location = location;

View File

@ -34,6 +34,11 @@ export class Session {
*/ */
sessionId: string; 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 * Properties defining the session
*/ */
@ -388,6 +393,7 @@ export class Session {
if (res.status === 200) { if (res.status === 200) {
// SUCCESS response from openvidu-server. Resolve token // SUCCESS response from openvidu-server. Resolve token
this.sessionId = res.data.id; this.sessionId = res.data.id;
this.createdAt = res.data.createdAt;
resolve(this.sessionId); resolve(this.sessionId);
} else { } else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status
@ -452,7 +458,18 @@ export class Session {
connection.subscribers.forEach(subscriber => { connection.subscribers.forEach(subscriber => {
subscribers.push(subscriber.streamId); 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; return this;
} }