Skip to content
Snippets Groups Projects
Commit 3102c52a authored by Bady's avatar Bady
Browse files

Update server-side event broadcasting

parent 4ebfe720
Branches
1 merge request!2Back-end
......@@ -26,7 +26,7 @@ var socketids = [];
io.on('connection', (socket) => {
let id = socket.id;
io.to(id).emit('leaves data', leavesdata);
socket.emit('leaves data', leavesdata);
socket.on('leaf text', (leafdata) => {
if(!socketids.includes(id)) { //checks if socketid is already assigned with leafid
......@@ -38,6 +38,6 @@ io.on('connection', (socket) => {
leavesdata[id]["leaftext"] = leafdata["leaftext"]; //if yes update the message
leafdata = leavesdata[id];
};
socket.emit('leaf data', leafdata);
io.emit('leaf data', leafdata);
});
});
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment