Hi,
The library works very well for sharing voice/video over rtc connection.
I have a problem sharing Uint8Array when i do conn.send(data) the conn.on('close') get triggered automatically
what i tried is
let c = document.getElementById("mySketcher");
let ctx = c.getContext("2d");
let imgData = ctx.getImageData(0, 0, c.width, c.height);
data = Buffer.from(imgData.data);
conn.send(data);
---- connection breaks here-------

The above shows what data i am trying to send.
i am using chrome Version 77.0.3865.120 (Official Build) (64-bit)
Does the browser allow this big buffer size to transfer? this is something around 1549412 bytes as per me.
Chunk your data. That message is too large to send in a single frame.
Module to chunk streams: https://www.npmjs.com/package/chunk-stream
Blog about maximum chunk size for RTCDataChannels (recommends 16kb chunks): http://viblast.com/blog/2015/2/5/webrtc-data-channel-message-size/
var chunks = require('chunk-stream')
inputStream.pipe(chunks(16000)).pipe(peer)
or, with write:
var chunks = require('chunk-stream')
var chunkStream = chunks(16000)
chunkStream.pipe(peer)
chunkStream.write(myData)
Thanks alot i will check this out. Looks like this is some webrtc guideline to follow. Closing this, not going to increase issue count of this awesome plugin.
Also someone else trying to send over canvas, found a better way to send it as dataurl instead which is far light though this might also require chunking at some moment.
For sender :=
let c = document.getElementById("mySketcher");
let ctx = c.getContext("2d");
let data = c.toDataURL();
data = Buffer.from(data);
conn.send(data);