MenuMenu

RTCMultiConnection.onclose

WebRTC SCTP data channel's close event

This event is fired as soon as WebRTC data channel closes.

Usage

connection.onclose = function(event) {
    var remoteUserId = event.userid;
    var remoteUserFullName = event.extra.fullName;

    alert('data connection closed between you and ' + remoteUserFullName);
};

Description

parameterdescription
userid data connection closed between you and this user-id
connection.onclose = function(event) {
    var remoteUserId = event.userid;
};
extra extra information
connection.onclose = function(event) {
    var remoteUserFullName = event.extra.fullName;
};

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 text chat
connection.session = {
    data: true
};

connection.onclose = function(event) {
    alert('data connection closed between you and ' + event.userid);
};

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