rtc

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

commit
9d7fcd73f3477a9a9edac0fa8a781c936d27afba
parent
5395944228d0d0012bc258a37b4547aa93f854d7
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-03-26 10:37
use own server with SSE

Diffstat

M www/patch.js 10 +++-------
M www/rtc/index.html 2 +-

2 files changed, 4 insertions, 8 deletions


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

@@ -1,6 +1,6 @@
    1     1 (function() {
    2     2 	var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    3    -1 	var baseUrl = 'https://patchbay.pub/pubsub/';
   -1     3 	var baseUrl = 'https://duct.ce9e.org/';
    4     4 
    5     5 	var randomString = function(length) {
    6     6 		var result = [];
@@ -19,13 +19,9 @@
   19    19 		return fetch(baseUrl + key, {method: 'POST', body: JSON.stringify(data)});
   20    20 	};
   21    21 
   22    -1 	// FIXME: prefer server send events
   23    22 	var listen = function(key, fn) {
   24    -1 		p = fetch(baseUrl + key);
   25    -1 		p.finally(() => listen(key, fn));
   26    -1 		return p
   27    -1 			.then(r => r.text())
   28    -1 			.then(data => fn(data && JSON.parse(data)))
   -1    23 		var evtSource = new EventSource(baseUrl + key + '?sse');
   -1    24 		evtSource.onmessage = msg => fn(JSON.parse(msg.data));
   29    25 	};
   30    26 
   31    27 	window.patch = {

diff --git a/www/rtc/index.html b/www/rtc/index.html

@@ -3,7 +3,7 @@
    3     3 <head>
    4     4 	<meta charset="utf-8" />
    5     5 	<title>duct rtc</title>
    6    -1 	<meta http-equiv="Content-Security-Policy" content="default-src 'self'; connect-src https://patchbay.pub">
   -1     6 	<meta http-equiv="Content-Security-Policy" content="default-src 'self'; connect-src http://duct.ce9e.org">
    7     7 	<meta name="viewport" content="width=device-width" />
    8     8 	<link rel="stylesheet" href="../common.css">
    9     9 	<link rel="stylesheet" href="rtc.css">