From 77b00187def78bd518b51b2ba1603d49cdd76d08 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 16 Jan 2021 16:27:02 +0200 Subject: [PATCH] fix channel type, callback --- webrtc/src/main/resources/static/client.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/webrtc/src/main/resources/static/client.js b/webrtc/src/main/resources/static/client.js index 059dc84bcb..9b3de9ef6d 100644 --- a/webrtc/src/main/resources/static/client.js +++ b/webrtc/src/main/resources/static/client.js @@ -38,11 +38,7 @@ var input = document.getElementById("messageInput"); function initialize() { var configuration = null; - peerConnection = new RTCPeerConnection(configuration, { - optional : [ { - RtpDataChannels : true - } ] - }); + peerConnection = new RTCPeerConnection(configuration); // Setup ice handling peerConnection.onicecandidate = function(event) { @@ -71,6 +67,11 @@ function initialize() { dataChannel.onclose = function() { console.log("data channel is closed"); }; + + peerConnection.ondatachannel = function (event) { + dataChannel = event.channel; + }; + } function createOffer() {