]> git.cworth.org Git - zombocom-ai/blobdiff - index.js
Perform a complete round trip when setting a name
[zombocom-ai] / index.js
index 49a85669e45c3c436ccf2141042d4ca30f9c1339..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)
@@ -124,6 +126,7 @@ io.on('connection', (socket) => {
                 const images = JSON.parse(data);
                 images.forEach((image) => {
                     image.id = state.images.length;
+                   image.comments = [];
                     io.emit('image', image);
                     state.images.push(image);
                 });