jbilcke-hf HF staff commited on
Commit
5971871
โ€ข
1 Parent(s): 5ba4b90

fix ws / wss

Browse files
Files changed (1) hide show
  1. public/index.js +2 -1
public/index.js CHANGED
@@ -29697,7 +29697,8 @@ class FacePoke {
29697
  async initializeWebSocket() {
29698
  console.log(`[FacePoke] Initializing WebSocket connection`);
29699
  const connect = () => {
29700
- this.ws = new WebSocket(`wss://${window.location.host}/ws`);
 
29701
  this.ws.onopen = this.handleWebSocketOpen.bind(this);
29702
  this.ws.onclose = this.handleWebSocketClose.bind(this);
29703
  this.ws.onerror = this.handleWebSocketError.bind(this);
 
29697
  async initializeWebSocket() {
29698
  console.log(`[FacePoke] Initializing WebSocket connection`);
29699
  const connect = () => {
29700
+ const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
29701
+ this.ws = new WebSocket(`${protocol}//${window.location.host}/ws`);
29702
  this.ws.onopen = this.handleWebSocketOpen.bind(this);
29703
  this.ws.onclose = this.handleWebSocketClose.bind(this);
29704
  this.ws.onerror = this.handleWebSocketError.bind(this);