From 2c5fc3b3c81d862d9f9eab7de11ae4a7b658e2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 1 Jun 2020 17:08:43 +0200 Subject: [PATCH] Allow sending strings through data channels --- components/script/dom/rtcdatachannel.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/script/dom/rtcdatachannel.rs b/components/script/dom/rtcdatachannel.rs index 3b29c0f0a4b..9d51cef77fd 100644 --- a/components/script/dom/rtcdatachannel.rs +++ b/components/script/dom/rtcdatachannel.rs @@ -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) -> () {}