Allow sending strings through data channels

This commit is contained in:
Fernando Jiménez Moreno 2020-06-01 17:08:43 +02:00
parent 82260a9d2b
commit 2c5fc3b3c8

View file

@ -274,7 +274,11 @@ impl RTCDataChannelMethods for RTCDataChannel {
// fn SetBinaryType(&self, value: DOMString) -> ();
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send
fn Send(&self, data: USVString) -> () {}
fn Send(&self, data: USVString) -> () {
if let Err(error) = self.channel.send(&data.0) {
warn!("Could not send data channel message. Error: {:?}", error);
}
}
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send!overload-1
fn Send_(&self, data: &Blob) -> () {}