treesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorPatrick2026-05-08 10:52:28 +0200
committerPatrick2026-05-08 10:52:28 +0200
commit6f098cea40bc3df947618e69494acd7a9586330c (patch)
tree8464b54ec1ae84a616d8dd13e7b967a00fcf4bc4
parent88b339f3c3916c856351821b37823f70e822ea57 (diff)
downloadzhttpws-6f098cea40bc3df947618e69494acd7a9586330c.tar.gz
zhttpws-6f098cea40bc3df947618e69494acd7a9586330c.zip
update ui
-rw-r--r--src/main.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig
index 328bcea..b8a0715 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -72,7 +72,7 @@ fn handle_request(alloc: std.mem.Allocator, io: Io, stream: Io.net.Stream) void
\\ button { width: 80px; height: 40px; }
\\ </style></head><body>
\\ <script>
- \\ const socket = new WebSocket(`wss://${window.location.host}``);
+ \\ const socket = new WebSocket(`wss://${window.location.host}`);
\\ socket.addEventListener("open", (event) => {
\\ tv.value += "Connected!\n";
\\ });
@@ -85,9 +85,10 @@ fn handle_request(alloc: std.mem.Allocator, io: Io, stream: Io.net.Stream) void
\\ socket.send(`${tn.value}: ${tb.value}`);
\\ tb.value = "";
\\ }
+ \\ tb.onkeypress = (e) => if (e.key === "Enter") Send();
\\ </script>
\\ <textarea id="tv" readonly></textarea>
- \\ <div><input type="text" id="tn" /><input type="text" id="tb" onkeypress="if (e.key === 'Enter') Send()" />
+ \\ <div><input type="text" id="tn" /><input type="text" id="tb" />
\\ <button onclick="Send()">Send</button></div>
\\ </body></html>
, .{ .status = .ok }) catch break;