usar url dinamica en index.html

This commit is contained in:
Cat /dev/Nulo 2023-01-22 22:04:25 -03:00
parent 832a4a9fc3
commit 360233de40

View file

@ -4,7 +4,9 @@
<script>
const el = document.querySelector("pre");
const id = location.hash.slice(1);
const ws = new WebSocket("ws://localhost:8080/logs/socket/" + id);
const ws = new WebSocket(
location.origin.replace(/^http/, "ws") + "/logs/socket/" + id
);
window.ws = ws;
ws.addEventListener("message", async (event) => {
el.append(await event.data.text());