Open
Description
Run the following code on two browser windows to create a call. Reload the page on one end. On the other end you will see multiple data channel creation events for the new connection, one for the new connection and one for the connection that now does not exist. Problem is more evident if instead of reloading you page back, wait for the connection close event to register on the other end and then page forward to start a new connection.
'use strict'
var quickconnect = require('rtc-quickconnect');
var crel = require('crel');
var qc = quickconnect('https://rtc.io/switchboard/', {
room: 'phantom-postchannel',
reactive: true
});
var logger = document.body.appendChild(crel('div'));
function append(msg) {
crel(logger, crel('p', msg));
}
qc.on('call:started', function(peerId) {
append('call started with peer ' + peerId);
append('call master: ' + qc.isMaster(peerId));
var newChannelId = (peerId < qc.id ? peerId : qc.id) + '-' + (peerId < qc.id ? qc.id : peerId);
append('creating new datachannel ' + newChannelId);
qc.createDataChannel(newChannelId);
append('waiting for channel open');
});
qc.on('call:ended', function(peerId) {
append('call ended with peer: ' + peerId);
});
qc.on('channel:opened', function(id, dc) {
append('channel opened, label: ' + dc.label);
});
qc.on('channel:closed', function(id, dc) {
append('channel closed, label: ' + dc.label);
});
append('waiting for call');
Metadata
Metadata
Assignees
Labels
No labels