JSFiddle - React, Tailwind, and code Playground

JavaScript

const orig = RTCPeerConnection.prototype.createDataChannel;

RTCPeerConnection.prototype.createDataChannel = function(label, options) { 
    const dc = orig.call(this, label, options); 
    dc.addEventListener("message", (ev) => { 
        var decodedString = String.fromCharCode.apply(null, new Uint8Array(ev.data));
        console.log(decodedString)
    } );
    return dc;
}