← Back to release summary

Blob support in WebRTC data channels

Category
WebRTC
Type
Chromium catches up
Status
Enabled by default (Chrome 129)
Intent stage
None

Summary

RTCDataChannel.send(Blob) is now implemented and the onMessage event can now optionally receive data of type Blob using the binaryType attribute. In addition to supporting sending strings and ArrayBuffers, you can chose to send a Blob instead as long as its size is below the SCTP transport maxMessageSize as indicated in the WebRTC specification. Using the binaryType attribute set to "blob", the onMessage event data attribute will be of type Blob instead of the currently supported ArrayBuffer.

Motivation

This allows developers to use Blobs, which could be backed by a File, which the Data Channel APIs and remove activity from the main thread related to loading the data. While it is possible to use asynchronous loading of Blobs with regular APIs, this is a much easier way for developers that is harder to misuse. It opens up possibilities for sending larger messages in future evolution of the specification.

Standards & signals

View on chromestatus.com