From deaf06bc4559b9c7f00d78d34e23d234d0196a21 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 9 Dec 2022 07:10:32 -0800 Subject: [PATCH] Tell server a name at first connection If there is a name in local storage, that is. --- index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.html b/index.html index c556792..243e1da 100644 --- a/index.html +++ b/index.html @@ -156,6 +156,14 @@ mute.addEventListener("click", () => { socket.on('reset', () => { images.replaceChildren(); + + /* Since the server is seeing us for the first time, let it + know our name (if we have one). */ + const name = localStorage.getItem('name'); + if (name) { + socket.emit('set-name', name); + return; + } }); socket.on('image', (image) => { -- 2.43.0