wongfei2009 commited on
Commit
38348ec
β€’
1 Parent(s): 8aafe2e

Update facePoke.ts

Browse files

Fix of https://github.com/jbilcke-hf/FacePoke/issues/6

Files changed (1) hide show
  1. client/src/lib/facePoke.ts +3 -1
client/src/lib/facePoke.ts CHANGED
@@ -50,7 +50,9 @@ export class FacePoke {
50
  console.log(`[FacePoke] Initializing WebSocket connection`);
51
 
52
  const connect = () => {
53
- this.ws = new WebSocket(`wss://${window.location.host}/ws`);
 
 
54
 
55
  this.ws.onopen = this.handleWebSocketOpen.bind(this);
56
  this.ws.onclose = this.handleWebSocketClose.bind(this);
 
50
  console.log(`[FacePoke] Initializing WebSocket connection`);
51
 
52
  const connect = () => {
53
+ const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
54
+ this.ws = new WebSocket(`${protocol}//${window.location.host}/ws`);
55
+
56
 
57
  this.ws.onopen = this.handleWebSocketOpen.bind(this);
58
  this.ws.onclose = this.handleWebSocketClose.bind(this);