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

9 lines
321 B
JavaScript

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