const dc = peerConnection.createDataChannel("Binary");
dc.binaryType = "arraybuffer";
dc.onmessage = (event) => {
const byteArray = new Uint8Array(event.data);
let hexString = "";
byteArray.forEach((byte) => {
hexString += `${byte.toString(16)} `;
});
};RTCDataChannel: binaryType property / notebook
RTCDataChannel: binaryType property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.