DataChannel
DataChannel copied to clipboard
Can't send array buffer type via DataChannel
I tried to send data array buffer but I couldn't, I tried sending simple array and it works fine. What should I do to send array buffer using this DataChannel
` function setChannel() { console.log("setChannel is working fine"); channel.open(); }
var channel = new DataChannel();
channel.onopen = function (userid) { console.log("channel opened successfully.") // channel.send("Every thing is ready for sending data, are you get this message?"); };
channel.onmessage = function (message, userid) { //console.log("Sender: " + message); console.log(" A message received from sender.") console.log(message); };
channel.onleave = function (userid) { console.log(" Sender have leave the channel!") };
// search for existing data channels channel.connect(); `
And for sending through the channel I used this code:
channel.send(myArrayBuffer)