Nirav Madhani commited on
Commit
0547f0e
·
verified ·
1 Parent(s): a7a403a

Update index.html

Browse files

Fix secure connection

Files changed (1) hide show
  1. index.html +2 -1
index.html CHANGED
@@ -327,7 +327,8 @@
327
 
328
  function connectWebSocket() {
329
  try {
330
- socket = new WebSocket(`ws://${window.location.host}/ws`);
 
331
 
332
  socket.onopen = () => {
333
  logMessage('websocket', 'Connected to server');
 
327
 
328
  function connectWebSocket() {
329
  try {
330
+ const wsUrl = `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}/ws`;
331
+ socket = new WebSocket(wsUrl);
332
 
333
  socket.onopen = () => {
334
  logMessage('websocket', 'Connected to server');