feat(log): Logs server field from jwt token

This commit is contained in:
hristoterezov 2016-09-28 14:55:39 -05:00
parent 8f4b94f732
commit fcc9532bde
3 changed files with 21 additions and 0 deletions

5
app.js
View File

@ -110,6 +110,11 @@ function init() {
var isUIReady = APP.UI.start();
if (isUIReady) {
APP.conference.init({roomName: buildRoomName()}).then(function () {
let server = APP.tokenData.server;
if(server) {
APP.conference.logEvent("server." + server, 1);
}
APP.UI.initConference();
APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {

View File

@ -1766,5 +1766,20 @@ export default {
// Update the view
APP.UI.setLocalRaisedHandStatus(raisedHand);
}
},
/**
* Log event to callstats and analytics.
* @param {string} name the event name
* @param {int} value the value (it's int because google analytics supports
* only int).
* NOTE: Should be used after conference.init
*/
logEvent(name, value) {
if(JitsiMeetJS.analytics) {
JitsiMeetJS.analytics.sendEvent(name, value);
}
if(room) {
room.sendApplicationLog(JSON.stringify({name, value}));
}
}
};

View File

@ -97,6 +97,7 @@ class TokenData{
this.payload = this.decodedJWT.payload;
if(!this.payload.context)
return;
this.server = this.payload.context.server;
let callerData = this.payload.context.user;
let calleeData = this.payload.context.callee;
if(callerData)