Minecraft-Realms-Emulator/Panel/wwwroot/js/serverLogsStream.js
2024-12-18 14:00:05 +01:00

13 lines
335 B
JavaScript

window.serverLogsStream = {
logs: "x",
start: (dotNetObject, serverId) => {
logs = new EventSource(`http://localhost:8080/api/admin/servers/${serverId}/logs`);
logs.onmessage = event => {
dotNetObject.invokeMethodAsync("ReceiveLog", event.data);
}
},
stop: () => logs.close()
}