]> git.cworth.org Git - zombocom-ai/blobdiff - index.js
Fix class of comments element
[zombocom-ai] / index.js
index 2c980dc796d3d1992db34646ed09d46e8de64c08..1239ea2fab43360d621942d40ecd95cacced79f3 100644 (file)
--- a/index.js
+++ b/index.js
@@ -85,11 +85,15 @@ io.on('connection', (socket) => {
     });
 
     socket.on('set-name', (name) => {
+        console.log("Received set-name event: " + name);
         socket.request.session.name = name;
+        socket.request.session.save();
     });
 
     // When any client comments, send that to all clients (including sender)
-    socket.on('comment', (comment) => {
+    socket.on('comment', (comment_text) => {
+        comment = { name: socket.request.session.name,
+                    text: comment_text }
         io.emit('comment', comment);
         state.comments.push(comment);
     });