Back to Samples

WebRTC samples Generate and transfer data

src/content/datachannel/datatransfer/index.html

latest1.1 KB
Original Source

WebRTC samples Generate and transfer data

This page generates and sends the specified amount of data via WebRTC datachannels.

To accomplish this in an interoperable way, the data is split into chunks which are then transferred via the datachannel. The datachannel is reliable and ordered by default which is well-suited to filetransfers.

Send and receive progress is monitored using HTML5 progress elements.

Generate and send data

MB (warning: very large values will potentially cause memory problems)

Ordered mode

Send progress:

Receive progress:

View the console to see logging.

The RTCPeerConnection objects pc1 and pc2 are in global scope, so you can inspect them in the console as well.

For more information about RTCDataChannel, see Getting Started With WebRTC.

View source on GitHub