(feature) Update UI & Resource Availability

This commit is contained in:
Elijah Dunemask 2023-03-15 15:20:08 +00:00
parent 11d8229eb5
commit 929193d272
44 changed files with 4747 additions and 27 deletions

27
src/servers/RconSocket.js Normal file
View file

@ -0,0 +1,27 @@
import { io } from "socket.io-client";
export default class RconSocket {
constructor(logUpdate, serverName) {
(this.sk = io("/", { query: { serverName } })), (this.logs = []);
this.logUpdate = logUpdate;
this.sk.on("push", this.onPush.bind(this));
this.sk.on("connect", this.onConnect.bind(this));
}
onPush(p) {
this.logs = [...this.logs, p];
this.logUpdate(this.logs);
}
send(m) {
this.sk.emit("msg", m);
}
onConnect() {
this.logs = [];
}
disconnect() {
if (!this.sk) return;
this.sk.disconnect();
}
}