Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

add logger

Philipp Hancke795b1cc4ec4f
diff --git a/estos_log.js b/estos_log.js
new file mode 100644
index 0000000000..b7e049b4ad
--- /dev/null
+++ b/estos_log.js
@@ -0,0 +1,23 @@
+Strophe.addConnectionPlugin('logger', {
+ // logs raw stanzas and makes them available for download as JSON
+ connection: null,
+ log: [],
+ init: function (conn) {
+ this.connection = conn;
+ this.connection.rawInput = this.log_incoming.bind(this);;
+ this.connection.rawOutput = this.log_outgoing.bind(this);;
+ },
+ log_incoming: function (stanza) {
+ this.log.push([new Date().getTime(), 'incoming', stanza]);
+ },
+ log_outgoing: function (stanza) {
+ this.log.push([new Date().getTime(), 'outgoing', stanza]);
+ },
+ // <a onclick="connection.logger.dump(event.target);">my download button</a>
+ dump: function (what, filename){
+ what.download = filename || 'xmpplog.json';
+ what.href = 'data:application/json;charset=utf-8,\n';
+ what.href += encodeURIComponent(JSON.stringify(this.log, null, ' '));
+ return true;
+ }
+});
diff --git a/index.html b/index.html
index 0c5f2dc7cd..6e34a230d7 100644
--- a/index.html
+++ b/index.html
@@ -5,6 +5,7 @@
<script src="libs/strophejingle.bundle.js"></script><!-- strophe.jingle bundle -->
<script src="libs/colibri.js"></script><!-- colibri focus implementation -->
<script src="muc.js"></script><!-- simple MUC library -->
+ <script src="estos_log.js"></script><!-- simple stanza logger -->
<script src="app.js"></script><!-- application logic -->
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css" />