Skip to content

Commit

Permalink
openvidu-node-client: createdAt property
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloFuente committed Sep 6, 2018
1 parent 332877d commit b69fbda
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
8 changes: 7 additions & 1 deletion openvidu-node-client/src/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
Expand Down
19 changes: 18 additions & 1 deletion openvidu-node-client/src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b69fbda

Please sign in to comment.