usar url dinamica en index.html
This commit is contained in:
parent
832a4a9fc3
commit
360233de40
1 changed files with 3 additions and 1 deletions
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue