Minecraft-Realms-Emulator/Panel/wwwroot/js/serverLogsStream.js

13 lines
362 B
JavaScript
Raw Normal View History

window.serverLogsStream = {
2024-05-30 08:42:18 -04:00
logs: "x",
start: (dotNetObject, serverId) => {
2024-05-30 08:42:18 -04:00
logs = new EventSource(`http://localhost:8080/api/admin/servers/${serverId}/logs`, { withCredentials: true });
logs.onmessage = event => {
dotNetObject.invokeMethodAsync("ReceiveLog", event.data);
}
2024-05-30 08:42:18 -04:00
},
stop: () => logs.close()
}