Commit 02019657 authored by Dennis Willers's avatar Dennis Willers 🏀

Multiplayer send only if a new Vote comes

parent 8a4896a0
Pipeline #432 passed with stages
in 2 minutes and 49 seconds
......@@ -83,14 +83,18 @@ server.on('connection',function(socket){
const req = JSON.parse(data);
hf.addMapToClient(clients, socket, req['mapId'], newClientList => {
clients = newClientList.slice();
if (hf.checkIfRequestHasVote(data)) {
sendToAllClientsAtSameMap(res, req['mapId']);
});
/*var is_kernel_buffer_full = socket.write(JSON.stringify(res.data) + '\n');
if(is_kernel_buffer_full){
console.log('Data was flushed successfully from kernel buffer i.e written successfully!');
} else {
socket.pause();
}*/
socket.write(JSON.stringify(res.data) + '\n');
}
});
//var is_kernel_buffer_full = socket.write(JSON.stringify(res.data) + '\n');
//if(is_kernel_buffer_full){
// console.log('Data was flushed successfully from kernel buffer i.e written successfully!');
//} else {
// socket.pause();
//}
} else {
console.log("Res was null");
}
......@@ -250,7 +254,7 @@ client.on('data',function(data){
// 87.78.129.86 | localhost
const testClient = net.connect({host: 'localhost', port: 3000}, () => {
/*const testClient = net.connect({host: '87.78.129.86', port: 3201}, () => {
console.log('connected to server!');
//testClient.write('Hello World Client!\r\n');
testClient.write(JSON.stringify({"mapId":"7fsfRSUCQ7YwfBEdRk_GivW6qzj","userId":"aKBNg9fbReqLedLiz1KFfA","name":"Summer 2021 - 01"}));
......
Markdown is supported
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