I am using RTC datachannel to transfer data (about 200kb
) every 100ms
( using timeout) between two peers( both chrome browsers, one windows pc n other mac).
For some reason, suddenly for no reason, in general after approx 5 minutes, one of the peers stop receiving the data, after some more time, the other peer also stops receiving the data.
After lot of debugging, I found out that both peers are still transmitting the data, and from network traffic analysis, it was clear that the other machine is receiving the data, but the browser does not invoke channel.onmessage
.
part of my code:
function timepot1(){ // I have cheked, this keeps getting called, no problem here
try {
....
channel.send(JSON.stringify(jsObject));
}catch (err) {
console.log(err);
}
setTimeout(timepot1, 100);
};
is there some known bug that is causing this, or is it because I am transferring large amount of data from both peers on same channel at same time?
EDIT
Apparently, I was using two datachannels( one for transmission in each direction), when I changed to single channel. It stopped working much quicker.
this is going sound stupid, but when I clear the console( in chrome
browser) the receiving of data on that browser stops almost immediately( but eh machine still receives the data ).