Boilerplate
This commit is contained in:
9
static/renderer.js
Normal file
9
static/renderer.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const ws_url = new URL('ws', window.location.href);
|
||||
ws_url.protocol = ws_url.protocol.replace('http', 'ws');
|
||||
const ws = new WebSocket(ws_url.href);
|
||||
|
||||
ws.onmessage = function(event) {
|
||||
const msg = JSON.parse(event.data);
|
||||
|
||||
console.log(msg);
|
||||
};
|
||||
Reference in New Issue
Block a user