close | RTCMultiConnection

Disconnect socket.io and leave all peer connections.

Usage

connection.close();

Demo

<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>

<script>
var connection = new RTCMultiConnection();

// this line is VERY_important
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';

// if you want audio+video conferencing
connection.session = {
    audio: true,
    video: true
};

btnLeave.onclick = function() {
    // stop all local cameras
    connection.attachStreams.forEach(function(localStream) {
        localStream.stop();
    });

    // close socket.io connection
    connection.close();
};

connection.openOrJoin('your-room-id');
</script>