Browse Source

feat(log): Logs server field from jwt token

j8
hristoterezov 8 years ago
parent
commit
fcc9532bde
3 changed files with 21 additions and 0 deletions
  1. 5
    0
      app.js
  2. 15
    0
      conference.js
  3. 1
    0
      modules/TokenData/TokenData.js

+ 5
- 0
app.js View File

110
     var isUIReady = APP.UI.start();
110
     var isUIReady = APP.UI.start();
111
     if (isUIReady) {
111
     if (isUIReady) {
112
         APP.conference.init({roomName: buildRoomName()}).then(function () {
112
         APP.conference.init({roomName: buildRoomName()}).then(function () {
113
+            let server = APP.tokenData.server;
114
+            if(server) {
115
+                APP.conference.logEvent("server." + server, 1);
116
+            }
117
+
113
             APP.UI.initConference();
118
             APP.UI.initConference();
114
 
119
 
115
             APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {
120
             APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {

+ 15
- 0
conference.js View File

1766
             // Update the view
1766
             // Update the view
1767
             APP.UI.setLocalRaisedHandStatus(raisedHand);
1767
             APP.UI.setLocalRaisedHandStatus(raisedHand);
1768
         }
1768
         }
1769
+    },
1770
+    /**
1771
+     * Log event to callstats and analytics.
1772
+     * @param {string} name the event name
1773
+     * @param {int} value the value (it's int because google analytics supports
1774
+     * only int).
1775
+     * NOTE: Should be used after conference.init
1776
+     */
1777
+    logEvent(name, value) {
1778
+        if(JitsiMeetJS.analytics) {
1779
+            JitsiMeetJS.analytics.sendEvent(name, value);
1780
+        }
1781
+        if(room) {
1782
+            room.sendApplicationLog(JSON.stringify({name, value}));
1783
+        }
1769
     }
1784
     }
1770
 };
1785
 };

+ 1
- 0
modules/TokenData/TokenData.js View File

97
         this.payload = this.decodedJWT.payload;
97
         this.payload = this.decodedJWT.payload;
98
         if(!this.payload.context)
98
         if(!this.payload.context)
99
             return;
99
             return;
100
+        this.server = this.payload.context.server;
100
         let callerData = this.payload.context.user;
101
         let callerData = this.payload.context.user;
101
         let calleeData = this.payload.context.callee;
102
         let calleeData = this.payload.context.callee;
102
         if(callerData)
103
         if(callerData)

Loading…
Cancel
Save