Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phantom data channels created on peer page reload/reconnect #57

Open
jtj02 opened this issue Oct 29, 2015 · 0 comments
Open

phantom data channels created on peer page reload/reconnect #57

jtj02 opened this issue Oct 29, 2015 · 0 comments

Comments

@jtj02
Copy link

jtj02 commented Oct 29, 2015

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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant