Archived
1
0

Web socket + fill setup

This commit is contained in:
Asher
2019-01-14 17:19:29 -06:00
committed by Kyle Carberry
parent 14f91686c5
commit 24a86b81ba
12 changed files with 64 additions and 65 deletions

View File

@ -29,7 +29,7 @@ export class Client {
this.tasks = [];
this.finishedTaskCount = 0;
this.progressElement = typeof document !== "undefined"
? document.querySelector("#status > #progress > #fill") as HTMLElement
? document.querySelector("#fill") as HTMLElement
: undefined;
this.mkDirs = this.wrapTask("Creating directories", 100, async () => {

View File

@ -115,7 +115,9 @@ class Connection implements ReadWriteConnection {
*/
private async openSocket(): Promise<WebSocket> {
this.dispose();
const socket = new WebSocket("websocket");
const socket = new WebSocket(
`${location.protocol === "https" ? "wss" : "ws"}://${location.host}/websocket`,
);
socket.binaryType = "arraybuffer";
this.activeSocket = socket;