repo: janusweb
action: commit
revision: 
path_from: 
revision_from: e5faf443675a44e560aa01743884e3483549eb40:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit e5faf443675a44e560aa01743884e3483549eb40
Author: James Baicoianu 
Date:   Thu Nov 10 03:13:09 2016 -0800

    Added disconnect() method and 'disconnect' event

diff --git a/scripts/external/JanusClientConnection.js b/scripts/external/JanusClientConnection.js
index f0037a46269e2561e49ed9b603b4a4a0d4894b16..
index ..a4e67d81503c0a8c60be0e1b7bd39f3e384c14a3 100644
--- a/scripts/external/JanusClientConnection.js
+++ b/scripts/external/JanusClientConnection.js
@@ -326,7 +326,12 @@ JanusClientConnection.prototype.connect = function() {
       this.send(this.msgQueue.shift());
     }
     this.dispatchEvent({type: 'connect'});
-  }.bind(this)
+  }.bind(this);
+
+  this._websocket.onclose = function() {
+    this.dispatchEvent({type: 'disconnect'});
+  }.bind(this);
+
   this._websocket.onmessage = this.onMessage.bind(this)  
 };
 JanusClientConnection.prototype.reconnect = function() {
@@ -336,6 +341,9 @@ JanusClientConnection.prototype.reconnect = function() {
     this.connect();
   }
 }
+JanusClientConnection.prototype.disconnect = function() {
+  this._websocket.close();
+}

 JanusClientConnection.prototype.sendLogon = function() {
   var msgData = {

-----END OF PAGE-----