diff --git a/html/control.html b/html/control.html index ea9b0c7..8e1e344 100644 --- a/html/control.html +++ b/html/control.html @@ -775,9 +775,11 @@ }); rtcPeerConnection.addEventListener('datachannel', function(e) { const dc = e.channel; - dc.addEventListener('message', function(e) { - dc.send('pong'); - }); + if (dc.label === 'keepalive') { + dc.addEventListener('message', function(e) { + dc.send('pong'); + }); + } }); rtcPeerConnection.addTransceiver('video', { direction: 'recvonly' }); //pc.addTransceiver('audio', {direction: 'recvonly'}); diff --git a/html/webrtc.html b/html/webrtc.html index 6da573f..599b35a 100644 --- a/html/webrtc.html +++ b/html/webrtc.html @@ -77,9 +77,11 @@ pc.addEventListener('datachannel', function(e) { const dc = e.channel; - dc.addEventListener('message', function(e) { - dc.send('pong'); - }); + if (dc.label === 'keepalive') { + dc.addEventListener('message', function(e) { + dc.send('pong'); + }); + } }); pc.remote_pc_id = request.id;