In this example I'm using simple-peer, although I have tested with other implementations as well as my own. This seems to be an issue with creating the data channels.
The example from the github page of simple-peer has been slightly modified and used: https://github.com/feross/simple-peer
var init = location.hash === '#1';
var config = {reliable:true, maxRetransmits:0, ordered:false};
var p = new SimplePeer({ initiator: init, trickle: false, channelConfig: config })
console.log(p);
p.on('error', function (err) { console.log('error', err) })
p.on('signal', function (data) {
console.log('SIGNAL', JSON.stringify(data))
document.querySelector('#outgoing').textContent = JSON.stringify(data)
})
document.querySelector('form').addEventListener('submit', function (ev) {
ev.preventDefault()
p.signal(JSON.parse(document.querySelector('#incoming').value))
})
p.on('connect', function () {
console.log('CONNECT')
console.log(p);
console.log(p._channel);
if(init){
for(let i=0;i<100;i++){
p.send(JSON.stringify(i));
}
}
})
var rec = 0;
p.on('data', function (data) {
rec++;
console.log('data: ' + JSON.parse(data));
if(!init){
p.send(data);
}
if(rec >= 100){
console.log("got all");
}
})
When initiating the connection using Firefox(61.0.2 x64), the connection is forced to reliable, even when trying to set it to unreliable using unreliable:false, ordered:false and maxRetransmits:0. Only the ordered property is properly used. When checking the connection object, the maxRetransmits and maxRetransmitTime settings are not exposed. If you connect to the Firefox connection using Chrome, both maxRetransmits and maxRetransmitTime will be set to 65535 in Chrome.
If you initiate the connection using Chrome, and connect using Firefox, the connection will be opened as unordered and unreliable in both Chrome and Firefox as well as having 0 maxRetransmits in Chrome.
Is this a bug, or am I missing something in setting up the connection to support unreliable data channels when initiating the connection using a Firefox browser?