Fixed client disconnect and navigation glitch

This commit is contained in:
Dunemask 2022-08-14 19:23:37 +00:00
parent ecf0516b39
commit a3cb448a7b
8 changed files with 34 additions and 39 deletions

View file

@ -1,4 +1,4 @@
import { Manager } from "socket.io-client";
import io from "socket.io-client";
import modes from "../modes.js";
import events from "../events.js";
@ -14,12 +14,11 @@ export default class Viewer {
}
viewJob(jobId, onLog, onClose) {
const mgr = new Manager(this.url, {
query: { mode: this.mode, jobId },
});
onLog = onLog ?? this.onLog.bind(this);
onClose = onClose ?? this.onClose.bind(this);
const sk = mgr.socket("/");
const sk = io(this.url, {
query: { mode: this.mode, jobId },
});
sk.on(events.JOB_LOG, onLog);
sk.on(events.JOB_CLS, onClose);
return sk;