Added updating the client about chats
This commit is contained in:
parent
1c0a992336
commit
ca6d822d7c
16
main.js
16
main.js
|
@ -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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue