Added updating the client about chats

This commit is contained in:
jsrobson10 2019-04-13 10:19:44 +10:00
parent 1c0a992336
commit ca6d822d7c
1 changed files with 15 additions and 1 deletions

16
main.js
View File

@ -528,7 +528,21 @@ var server = net.createServer(function(socket)
// Write it to the chats table // Write it to the chats table
sqlite3_insertData("chats", { sqlite3_insertData("chats", {
name: data.name name: data.name
}) });
// Update all the clients, loop over them
for(var i=0;i<connections.length;i++)
{
// Is this an active connection
if(connections[i])
{
// Send them the chat update
socket_write(connections[i], {
mode: "new_chat",
name: data.name
});
}
}
} }
} }
}); });