MenuSend text messages using WebRTC data channels
connection.send('text-message');
// objects
connection.send({
a: true,
b: 1,
c: 'string',
e: {
hello: 'hmm'
}
});
// file
connection.send(file || blob);
You can receive messages using onmessage event.