简体   繁体   中英

WebRTC: data transfer issue

I'm trying to send ArrayBuffer using WebRTC and simple-peer package. And I got these issues:

  • Another browser receives several events with Uint8Arrays which are part of the original ArrayBuffer. Length of each Uint8Array is not greater than 262528. It happens when I send large ArrayBuffer from chrome to chrome.
  • I get TypeError: The expression cannot be converted to return the specified type. error on sender browser when I send large ArrayBuffer from firefox to chrome.

But everything is fine when:

  • ArrayBuffer length is small.
  • when I send data from chrome to firefox.

I use peer.send(data) and peer.on('data', callback) functions from simple-peer and code is really simple so I have no idea what's going wrong.

According to THAT article, there are a message size limitations. The conclusion is:

All In all, the takeaway is that a 16 Kbyte message size is the one allowing for the highest throughput, while also being the most portable one. By the way, in some WebRTC tutorials and literature, the authors recommend using 16 Kbytes but they don't tell you why. Well now you know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM