patient is comatose and is missing both testicles and eyeballs but is legally alive
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
"use strict";
|
|
/**
|
|
* webrtc page script
|
|
*
|
|
* Author: Peter Harpending <peterharpending@qpq.swiss>
|
|
* Date: 2026-02-04
|
|
* Copyright: Copyright (c) 2026 QPQ AG
|
|
*
|
|
* Reference: https://git.qpq.swiss/QPQ-AG/research-megadoc/src/commit/c7c4592d4b21ad120145ef63334471a1a7ec1e60/paste/2026-02/grok-webrtc.html
|
|
*
|
|
* @module
|
|
*/
|
|
main();
|
|
async function main() {
|
|
// start websocket immediately
|
|
let ws;
|
|
let init = document.getElementById('init');
|
|
let init_join = document.getElementById('init-join');
|
|
// handle button click
|
|
init_join.addEventListener('click', function () {
|
|
init.hidden = true;
|
|
ws = new WebSocket('/ws/webrtc');
|
|
ws.onopen = function (e) { console.log('ws open'); };
|
|
ws.onclose = function (e) { console.warn('ws closed'); };
|
|
ws.onerror = function (e) { console.error('ws error:', e); };
|
|
ws.onmessage =
|
|
function (e) {
|
|
// console.log('ws message:', e.data);
|
|
let message = JSON.parse(e.data);
|
|
handle_ws_msg(message);
|
|
};
|
|
});
|
|
}
|
|
function handle_ws_msg(message) {
|
|
console.log('message from server:', message);
|
|
}
|
|
function ws_send_json(ws, x) {
|
|
let s = JSON.stringify(x, undefined, 4);
|
|
console.log('sending:\n', s);
|
|
ws.send(s);
|
|
}
|
|
//# sourceMappingURL=webrtc.js.map
|