Skip to content

Commit

Permalink
Connections need to be closed and not left hanging.
Browse files Browse the repository at this point in the history
  • Loading branch information
jthomas authored and jthomas committed Jan 15, 2013
1 parent 39bc0ad commit 923c367
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/webrtc.io.js
Expand Up @@ -84,6 +84,8 @@ var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || nav

rtc._socket.onclose = function(data) {
rtc.fire('disconnect stream', rtc._socket.id);
if(typeof(rtc.peerConnections[rtc._socket.id]) != 'undefined')
rtc.peerConnections[rtc._socket.id].close();
delete rtc.peerConnections[rtc._socket.id];
};

Expand Down Expand Up @@ -112,6 +114,8 @@ var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || nav

rtc.on('remove_peer_connected', function(data) {
rtc.fire('disconnect stream', data.socketId);
if(typeof(rtc.peerConnections[data.socketId]) != 'undefined')
rtc.peerConnections[data.socketId].close();
delete rtc.peerConnections[data.socketId];
});

Expand Down

0 comments on commit 923c367

Please sign in to comment.