rtc

minimal webrtc client
git clone https://git.ce9e.org/rtc.git

commit
0deef8cd1bc8c9756dab3cb3d2d4c9bf662303e6
parent
f65d18e27c2eb54a196684337667bee90255b1fc
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-04-03 15:04
ignore messages from unknown senders

Diffstat

M www/rtc/rtc.js 20 +++++++++++++-------

1 files changed, 13 insertions, 7 deletions


diff --git a/www/rtc/rtc.js b/www/rtc/rtc.js

@@ -29,9 +29,11 @@
   29    29 	};
   30    30 
   31    31 	var closeConnection = function(sender) {
   32    -1 		cons[sender].video.remove();
   33    -1 		cons[sender].con.close();
   34    -1 		delete cons[sender];
   -1    32 		if (sender in cons) {
   -1    33 			cons[sender].video.remove();
   -1    34 			cons[sender].con.close();
   -1    35 			delete cons[sender];
   -1    36 		}
   35    37 	};
   36    38 
   37    39 	var getConnection = function(sender) {
@@ -101,13 +103,17 @@
  101   103 	};
  102   104 
  103   105 	var handleAnswer = function(sender, answer) {
  104    -1 		var con = cons[sender].con;
  105    -1 		con.setRemoteDescription(answer);
   -1   106 		if (sender in cons) {
   -1   107 			var con = cons[sender].con;
   -1   108 			con.setRemoteDescription(answer);
   -1   109 		}
  106   110 	};
  107   111 
  108   112 	var handleCandidate = function(sender, candidate) {
  109    -1 		var con = cons[sender].con;
  110    -1 		con.addIceCandidate(candidate);
   -1   113 		if (sender in cons) {
   -1   114 			var con = cons[sender].con;
   -1   115 			con.addIceCandidate(candidate);
   -1   116 		}
  111   117 	};
  112   118 
  113   119 	patch.listen(queue + ':' + queuePassword, function(event) {