- commit
- bcde335558213cb6e239736a6a381828c0fcfd2d
- parent
- c48980906d5454a7f76f0253310cd08892e357f4
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-04-03 15:53
rename patch to signal
Diffstat
M | www/rtc/index.html | 2 | +- |
M | www/rtc/rtc.js | 22 | +++++++++++----------- |
R | www/patch.js -> www/signal.js | 2 | +- |
3 files changed, 13 insertions, 13 deletions
diff --git a/www/rtc/index.html b/www/rtc/index.html
@@ -36,7 +36,7 @@ 36 36 <button>Send</button> 37 37 </form> 38 38 </div>39 -1 <script src="../patch.js"></script>-1 39 <script src="../signal.js"></script> 40 40 <script src="rtc.js"></script> 41 41 </body> 42 42 </html>
diff --git a/www/rtc/rtc.js b/www/rtc/rtc.js
@@ -1,4 +1,4 @@1 -1 /* global patch */-1 1 /* global signal */ 2 2 /* eslint no-console: "off" */ 3 3 (function() { 4 4 // https://webrtc.github.io/samples/ @@ -8,8 +8,8 @@ 8 8 // offer/answer -- media stream information 9 9 10 10 var room = location.hash.substr(1);11 -1 var queue = patch.randomString(10);12 -1 var queuePassword = patch.randomString(10);-1 11 var queue = signal.randomString(10); -1 12 var queuePassword = signal.randomString(10); 13 13 console.log('own queue', queue); 14 14 15 15 var container = document.querySelector('.rtc-videos'); @@ -50,7 +50,7 @@ 50 50 iceServers: [{urls: 'stun:ce9e.org:3478'}], 51 51 }); 52 52 con.addEventListener('icecandidate', function(event) {53 -1 patch.post(sender, {sender: queue, type: 'candidate', data: event.candidate});-1 53 signal.post(sender, {sender: queue, type: 'candidate', data: event.candidate}); 54 54 }); 55 55 con.addEventListener('negotiationneeded', function() { 56 56 makeOffer(sender); @@ -85,7 +85,7 @@ 85 85 var con = getConnection(sender); 86 86 con.createOffer().then(offer => { 87 87 con.setLocalDescription(offer).then(() => {88 -1 patch.post(sender, {sender: queue, type: 'offer', data: offer});-1 88 signal.post(sender, {sender: queue, type: 'offer', data: offer}); 89 89 }); 90 90 }); 91 91 } @@ -96,7 +96,7 @@ 96 96 con.setRemoteDescription(offer).then(() => { 97 97 con.createAnswer().then(answer => { 98 98 con.setLocalDescription(answer).then(() => {99 -1 patch.post(sender, {sender: queue, type: 'answer', data: answer});-1 99 signal.post(sender, {sender: queue, type: 'answer', data: answer}); 100 100 }); 101 101 }); 102 102 }); @@ -116,7 +116,7 @@ 116 116 } 117 117 }; 118 118119 -1 patch.listen(queue + ':' + queuePassword, function(msg) {-1 119 signal.listen(queue + ':' + queuePassword, function(msg) { 120 120 if (msg.type === 'offer') { 121 121 handleOffer(msg.sender, msg.data); 122 122 } else if (msg.type === 'answer') { @@ -128,10 +128,10 @@ 128 128 } 129 129 }); 130 130131 -1 patch.post(room, {sender: queue, type: 'announce'});-1 131 signal.post(room, {sender: queue, type: 'announce'}); 132 132 133 133 window.addEventListener('beforeunload', function() {134 -1 patch.beacon(room, {sender: queue, type: 'leave'});-1 134 signal.beacon(room, {sender: queue, type: 'leave'}); 135 135 }); 136 136 137 137 var updateConnections = function() { @@ -222,7 +222,7 @@ 222 222 if (!input.value) { 223 223 return; 224 224 }225 -1 patch.post(room, {sender: queue, type: 'chat', text: input.value}).then(function() {-1 225 signal.post(room, {sender: queue, type: 'chat', text: input.value}).then(function() { 226 226 input.value = ''; 227 227 }); 228 228 }); @@ -234,7 +234,7 @@ 234 234 history.scrollTop = history.scrollHeight; 235 235 }; 236 236237 -1 patch.listen(room, function(msg) {-1 237 signal.listen(room, function(msg) { 238 238 if (msg.type === 'chat') { 239 239 addChatMsg(msg.text); 240 240 } else if (msg.type === 'announce') {
diff --git a/www/patch.js b/www/signal.js
@@ -28,7 +28,7 @@ 28 28 evtSource.onmessage = msg => fn(JSON.parse(msg.data)); 29 29 }; 30 3031 -1 window.patch = {-1 31 window.signal = { 32 32 'post': post, 33 33 'beacon': beacon, 34 34 'listen': listen,