Book Image

Learning WebRTC

By : Daniel M. Ristic
Book Image

Learning WebRTC

By: Daniel M. Ristic

Overview of this book

Table of Contents (16 chapters)
Learning WebRTC
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Breaking down a file into chunks


Now that we have a file, we need to get it ready to send to the other user. The easiest approach to this problem is to take the entire file and call our send method with the data. This will take the entire file and give it to the data channel to process as one large message:

Once this happens, the data channel will take the message and try to send all the data through the connection between the clients. Let us say that the user is trying to share their entire music collection, which comes to a size of 50 GB. The data channel will tell the SCTP protocol that it has one message that starts at 0 bytes and ends at our file size, which is 50 GB.

This is where the problems start to arise. If the user is on a bad network connection, the message could fail to send. If we have our data channel setup in a reliable or retry mode, the underlying protocol will simply discard the currently sent data and retry to send the entire message again. This means that both users have...