From 5288282ae73cbb46600246df919126c9d4eaa7d4 Mon Sep 17 00:00:00 2001 From: savinmax Date: Sat, 13 Jun 2026 13:35:26 +0200 Subject: [PATCH] feat(example): add room support to browser chat client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update example/index.html to allow users to specify a room via the UI: - Add room name text input with '/' as default - Add 'Join Room' button that (re)connects to the specified room - Construct WebSocket URL using the room path (ws://host:port/room) - Display connection status with current room name - Derive initial room from browser URL hash (e.g., #/chat → /chat) - Update URL hash on room change for shareable links - Listen for hashchange events for URL-driven navigation - Add Ctrl+Enter shortcut for sending messages - Improve styling with flexbox layout for controls Demo: open index.html#/chat in two tabs and index.html#/game in another. Messages in /chat stay isolated from /game. 🤖 Assisted by the code-assist SOP --- example/index.html | 273 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 246 insertions(+), 27 deletions(-) diff --git a/example/index.html b/example/index.html index c519a7f..223842d 100644 --- a/example/index.html +++ b/example/index.html @@ -9,14 +9,68 @@

P2P Chat

+
+ + + + Disconnected +
- -
- +
+ + +