mirror of
https://github.com/andreili/camera-streamer.git
synced 2025-08-23 19:34:07 +02:00
webrtc: check datachannel label for ping/pong
This commit is contained in:
parent
520350ed67
commit
400e036ea2
@ -775,9 +775,11 @@
|
|||||||
});
|
});
|
||||||
rtcPeerConnection.addEventListener('datachannel', function(e) {
|
rtcPeerConnection.addEventListener('datachannel', function(e) {
|
||||||
const dc = e.channel;
|
const dc = e.channel;
|
||||||
|
if (dc.label === 'keepalive') {
|
||||||
dc.addEventListener('message', function(e) {
|
dc.addEventListener('message', function(e) {
|
||||||
dc.send('pong');
|
dc.send('pong');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
rtcPeerConnection.addTransceiver('video', { direction: 'recvonly' });
|
rtcPeerConnection.addTransceiver('video', { direction: 'recvonly' });
|
||||||
//pc.addTransceiver('audio', {direction: 'recvonly'});
|
//pc.addTransceiver('audio', {direction: 'recvonly'});
|
||||||
|
@ -77,9 +77,11 @@
|
|||||||
|
|
||||||
pc.addEventListener('datachannel', function(e) {
|
pc.addEventListener('datachannel', function(e) {
|
||||||
const dc = e.channel;
|
const dc = e.channel;
|
||||||
|
if (dc.label === 'keepalive') {
|
||||||
dc.addEventListener('message', function(e) {
|
dc.addEventListener('message', function(e) {
|
||||||
dc.send('pong');
|
dc.send('pong');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
pc.remote_pc_id = request.id;
|
pc.remote_pc_id = request.id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user