repo: janusweb action: commit revision: path_from: revision_from: e5faf443675a44e560aa01743884e3483549eb40: path_to: revision_to:
commit e5faf443675a44e560aa01743884e3483549eb40 Author: James BaicoianuDate: 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
--- 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-----