Skip to content

Commit 6a132f3

Browse files
author
dimaspirit
committed
add closeConnection
1 parent 500bfed commit 6a132f3

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

js/modules/webrtc/qbWebRTCSession.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,28 @@ WebRTCSession.prototype.stop = function(extension) {
361361
self._close();
362362
};
363363

364+
/**
365+
* [function close connection with user]
366+
* @param {[type]} userId [id of user]
367+
*/
368+
WebRTCSession.prototype.closeConnection = function(userId) {
369+
var self = this,
370+
peer = this.peerConnections[userId];
371+
372+
if(peer) {
373+
peer.release();
374+
375+
if (typeof self.onSessionConnectionStateChangedListener === 'function'){
376+
Utils.safeCallbackCall(self.onSessionConnectionStateChangedListener, self, userId, RTCPeerConnection.State.CLOSED);
377+
}
378+
379+
self._closeSessionIfAllConnectionsClosed();
380+
} else {
381+
Helpers.traceWarn('Not found connection with user (' + userId + ')');
382+
}
383+
};
384+
385+
364386
/**
365387
* Update a call
366388
* @param {array} A map with custom parameters

0 commit comments

Comments
 (0)