Sergidev commited on
Commit
b9d6f8c
·
verified ·
1 Parent(s): d87d7ec

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +2 -1
static/script.js CHANGED
@@ -27,7 +27,8 @@ function resizeCanvases() {
27
  resizeCanvases();
28
  window.addEventListener("resize", resizeCanvases);
29
 
30
- const ws = new WebSocket(`ws://${window.location.host}/ws`);
 
31
 
32
  ws.onmessage = (event) => {
33
  const message = JSON.parse(event.data);
 
27
  resizeCanvases();
28
  window.addEventListener("resize", resizeCanvases);
29
 
30
+ const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
31
+ const ws = new WebSocket(`${protocol}//${window.location.host}/ws`);
32
 
33
  ws.onmessage = (event) => {
34
  const message = JSON.parse(event.data);