basic websocket handling and testing

This commit is contained in:
wisplite
2026-04-07 12:01:42 -05:00
parent 5449dc7fe9
commit 27dc7818f7
4 changed files with 77 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
function test() {
const ws = new WebSocket("ws://localhost:8080/tether");
ws.onmessage = (event) => {
console.log(event.data);
};
ws.onopen = () => {
console.log("Connected to server");
ws.send(JSON.stringify({
type: "subscribe",
channel: "messages",
}));
};
ws.onclose = () => {
console.log("Disconnected from server");
};
}
test();