diff --git a/server/lib/Peer.js b/server/lib/Peer.js index 70b2394..a345a16 100644 --- a/server/lib/Peer.js +++ b/server/lib/Peer.js @@ -23,10 +23,14 @@ class Peer extends EventEmitter this._joined = false; + this._joinedTimestamp = null; + this._inLobby = false; this._authenticated = false; + this._authenticatedTimestamp = null; + this._roles = [ userRoles.NORMAL ]; this._displayName = false; @@ -39,6 +43,8 @@ class Peer extends EventEmitter this._raisedHand = false; + this._raisedHandTimestamp = null; + this._transports = new Map(); this._producers = new Map(); @@ -135,9 +141,18 @@ class Peer extends EventEmitter set joined(joined) { + joined ? + this._joinedTimestamp = Date.now() : + this._joinedTimestamp = null; + this._joined = joined; } + get joinedTimestamp() + { + return this._joinedTimestamp; + } + get inLobby() { return this._inLobby; @@ -157,6 +172,10 @@ class Peer extends EventEmitter { if (authenticated !== this._authenticated) { + authenticated ? + this._authenticatedTimestamp = Date.now() : + this._authenticatedTimestamp = null; + const oldAuthenticated = this._authenticated; this._authenticated = authenticated; @@ -165,6 +184,11 @@ class Peer extends EventEmitter } } + get authenticatedTimestamp() + { + return this._authenticatedTimestamp; + } + get roles() { return this._roles; @@ -231,9 +255,18 @@ class Peer extends EventEmitter set raisedHand(raisedHand) { + raisedHand ? + this._raisedHandTimestamp = Date.now() : + this._raisedHandTimestamp = null; + this._raisedHand = raisedHand; } + get raisedHandTimestamp() + { + return this._raisedHandTimestamp; + } + get transports() { return this._transports; @@ -333,11 +366,12 @@ class Peer extends EventEmitter { const peerInfo = { - id : this.id, - displayName : this.displayName, - picture : this.picture, - roles : this.roles, - raisedHand : this.raisedHand + id : this.id, + displayName : this.displayName, + picture : this.picture, + roles : this.roles, + raisedHand : this.raisedHand, + raisedHandTimestamp : this.raisedHandTimestamp }; return peerInfo;