Andy Hin
Andy Hin

Reputation: 31893

WebRTC Data Channel - max data size?

I'm using the WebRTC data channel to send JSON data. Seems to be working fine for small packets of data.

However, I'm trying to send a larger package (HTML of a webpage, base64 encoded, so maybe a few hundred KB), it never makes it to the other end.

Is there a max size?

Upvotes: 10

Views: 8760

Answers (1)

Svetlin Mladenov
Svetlin Mladenov

Reputation: 4427

I think the spec doesn't say a word about max data size. In practice 16 KB is the maximum. Take a look at this blog post and especially the throughput / packet size diagram. This result has been achieved experimentally and is the one allowing for most compatibility between webrtc implementations.

I've managed to send packets as large as 256 KB (and even larger if memory serves me right) between two Firefox instances. This was about an year ago and since then the implementation may have changed an the max data size with it.

If you want to send packets larger than 16 K you have to fragment them first. The fragmentation has to be implemented as part of you application protocol.

Upvotes: 13

Related Questions