yasserrmd commited on
Commit
8073ead
·
verified ·
1 Parent(s): 31ccf4f

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +3 -1
static/index.html CHANGED
@@ -382,7 +382,9 @@ document.addEventListener('DOMContentLoaded', () => {
382
 
383
  // Function to connect/reconnect WebSocket
384
  function connectWebSocket() {
385
- ws = new WebSocket('wss://huggingface.co/spaces/yasserrmd/GratiCraft/ws');
 
 
386
 
387
  ws.onopen = () => {
388
  addMessage('Connected to the server.', 'system');
 
382
 
383
  // Function to connect/reconnect WebSocket
384
  function connectWebSocket() {
385
+
386
+ const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
387
+ ws = new WebSocket(`${protocol}//${window.location.host}/ws/${endpoint}`);
388
 
389
  ws.onopen = () => {
390
  addMessage('Connected to the server.', 'system');