]> git.cworth.org Git - zombocom-ai/commitdiff
Perform a complete round trip when setting a name
authorCarl Worth <cworth@cworth.org>
Fri, 9 Dec 2022 21:13:06 +0000 (13:13 -0800)
committerCarl Worth <cworth@cworth.org>
Fri, 9 Dec 2022 21:13:06 +0000 (13:13 -0800)
So a newly-set name ends up on the client (and the client knows the
server has it).

index.js

index b0e7d7ae4126428d383ddd31731f09feda8a570a..07da00a59a99919049ac8d9c6319e2a7a0a42c83 100644 (file)
--- a/index.js
+++ b/index.js
@@ -85,6 +85,8 @@ io.on('connection', (socket) => {
         console.log("Received set-name event: " + name);
         socket.request.session.name = name;
         socket.request.session.save();
+       // Complete the round trip to the client
+       socket.emit('inform-name', socket.request.session.name);
     });
 
     // When any client comments, send that to all clients (including sender)