diff --git a/src/snek/static/container.js b/src/snek/static/container.js index edcdf4d..3261184 100644 --- a/src/snek/static/container.js +++ b/src/snek/static/container.js @@ -25,7 +25,7 @@ export class Container extends EventHandler{ }); } - this.refresh() + //this.refresh() this.terminal.focus() } refresh(){ @@ -40,8 +40,6 @@ export class Container extends EventHandler{ this._fitAddon.fit(); } - - constructor(channelUid,log){ super() this.terminal = new Terminal({ cursorBlink: true ,theme: { @@ -63,7 +61,15 @@ export class Container extends EventHandler{ this.terminal.write(new TextDecoder().decode(fixedData)); }) - this.ws = new WebSocket(`/container/sock/${channelUid}.json`) + + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + const host = window.location.host; + const wsUrl = `${protocol}//${host}/container/sock/${this.channelUid}.json`; + this.ws = new WebSocket(wsUrl); + + + + this.ws.binaryType = "arraybuffer"; // Support binary data this.ws.onmessage = (event) => { this.emit("stdout", event.data)