prepare websockets

This commit is contained in:
marlonerler
2024-07-04 16:18:40 +02:00
parent c97e3b5450
commit 40b393b6b3
3 changed files with 24 additions and 7 deletions
+4 -3
View File
@@ -57,7 +57,8 @@
}
// src/index.tsx
document.querySelector("main").append(
/* @__PURE__ */ createElement("h1", null, "Hello there!")
);
var ws = new WebSocket(`ws://${window.location.host}`);
ws.onopen = () => ws.send("Hello!");
ws.onmessage = (data) => console.log(data);
document.querySelector("main").append(/* @__PURE__ */ createElement("h1", null, "Hello there!"));
})();
+6 -3
View File
@@ -1,5 +1,8 @@
import * as React from "bloatless-react";
document.querySelector("main")!.append(
<h1>Hello there!</h1>
);
const ws = new WebSocket(`ws://${window.location.host}`);
ws.onopen = () => ws.send("Hello!")
ws.onmessage = (data) => console.log(data);
document.querySelector("main")!.append(<h1>Hello there!</h1>);