DataChannel.js is a JavaScript library useful to write many-to-many i.e. group file/data sharing or text chat applications. Its syntax is easier to use and understand. It highly simplifies complex tasks like any or all user rejection/ejection; direct messages delivery; and more.
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)
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)