Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Voting
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dennis Willers
Voting
Commits
02019657
Commit
02019657
authored
Aug 21, 2021
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Multiplayer send only if a new Vote comes
parent
8a4896a0
Pipeline
#432
passed with stages
in 2 minutes and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
socket.js
socket.js
+12
-8
No files found.
socket.js
View file @
02019657
...
...
@@ -83,14 +83,18 @@ server.on('connection',function(socket){
const
req
=
JSON
.
parse
(
data
);
hf
.
addMapToClient
(
clients
,
socket
,
req
[
'
mapId
'
],
newClientList
=>
{
clients
=
newClientList
.
slice
();
sendToAllClientsAtSameMap
(
res
,
req
[
'
mapId
'
]);
if
(
hf
.
checkIfRequestHasVote
(
data
))
{
sendToAllClientsAtSameMap
(
res
,
req
[
'
mapId
'
]);
}
else
{
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();
}*/
/
/
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"}));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment