From: Carl Worth Date: Fri, 9 Dec 2022 15:10:32 +0000 (-0800) Subject: Tell server a name at first connection X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=deaf06bc4559b9c7f00d78d34e23d234d0196a21;p=zombocom-ai Tell server a name at first connection If there is a name in local storage, that is. --- 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) => {