소스 검색

feat(log): Logs server field from jwt token

j8
hristoterezov 8 년 전
부모
커밋
fcc9532bde
3개의 변경된 파일21개의 추가작업 그리고 0개의 파일을 삭제
  1. 5
    0
      app.js
  2. 15
    0
      conference.js
  3. 1
    0
      modules/TokenData/TokenData.js

+ 5
- 0
app.js 파일 보기

@@ -110,6 +110,11 @@ function init() {
110 110
     var isUIReady = APP.UI.start();
111 111
     if (isUIReady) {
112 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 118
             APP.UI.initConference();
114 119
 
115 120
             APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {

+ 15
- 0
conference.js 파일 보기

@@ -1766,5 +1766,20 @@ export default {
1766 1766
             // Update the view
1767 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 파일 보기

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

Loading…
취소
저장