Sunday, 21 June 2020

File sharing through WebRTC failing for large files (greater than 6 mb) .

I'm making a file sharing application with WebRTC and Nodejs using the wrtc npm module. I'm making read stream of the file and sending it over the data channel and on the recieving end I'm writing the stream to a new file. Small files (less than 6 mb) are being sent sucessfully, but on sending larger files i'm getting this error after the file has been sent partially :/home/machine/Desktop/WebRTC-FileShare/node_modules/wrtc/lib/index.js:48 this._send(data); ^ DOMException [InvalidStateError]: RTCDataChannel.readyState is not 'open' One interesting thing i noticed is that when i try to send files (any size, even 400mb) from windows 10 machine to a linux mint machine they are succesfully sent but when i try to send them from the Linux Mint machine to the windows 10 then only i'm getting this error.The data channel gets closed in the middle of the process, usually after sending 5mb to 6mb of data. I tried setting the highWaterMark of read stream to 8000, 16000, 160000 bytes but it always gives the same error after sending around 5-6 mb of data. One thing to note is that the peer connection is not closed, only the data channel is getting closed. The peer connection stays up all time during the transfer.I thought the reason might be backpressure so i setup the onbufferedamountlow event handler but it never gets fired. So that is also not a problem. How to get rid of this? Also why does it work on windows and not linux?

Submitted June 21, 2020 at 09:45PM by DeusExMachina24

No comments:

Post a Comment