Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Tabu-Middleware
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
Tabu-Middleware
Commits
9f0d0040
Commit
9f0d0040
authored
Jan 02, 2021
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Synchronisation if new Game starts
parent
1fa02e50
Pipeline
#336
passed with stages
in 3 minutes and 16 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
events.js
events.js
+3
-0
socket.js
socket.js
+8
-13
No files found.
events.js
View file @
9f0d0040
...
@@ -274,6 +274,9 @@ function createRouter(db) {
...
@@ -274,6 +274,9 @@ function createRouter(db) {
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
500
).
json
({
status
:
'
false
'
});
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
500
).
json
({
status
:
'
false
'
});
}
else
{
}
else
{
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
200
).
json
({
status
:
'
true
'
});
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
200
).
json
({
status
:
'
true
'
});
socket
.
emit
(
'
newGame
'
,
{
sessionName
:
spielname
});
}
}
}
}
);
);
...
...
socket.js
View file @
9f0d0040
...
@@ -16,8 +16,6 @@ var position = {
...
@@ -16,8 +16,6 @@ var position = {
};
};
var
currentCard
=
{};
var
currentCard
=
{};
var
newRound
=
{};
var
endRound
=
{};
Socketio
.
on
(
"
connection
"
,
socket
=>
{
Socketio
.
on
(
"
connection
"
,
socket
=>
{
console
.
log
(
'
new Socket connect
'
);
console
.
log
(
'
new Socket connect
'
);
...
@@ -48,32 +46,29 @@ Socketio.on("connection", socket => {
...
@@ -48,32 +46,29 @@ Socketio.on("connection", socket => {
for
(
var
key
in
currentCard
)
{
for
(
var
key
in
currentCard
)
{
socket
.
emit
(
key
,
currentCard
[
key
])
socket
.
emit
(
key
,
currentCard
[
key
])
}
}
/*for (var key in newRound) {
socket
.
on
(
"
newGame
"
,
data
=>
{
socket.emit(key, newRound[key])
console
.
log
(
'
New Game from:
'
,
data
.
sessionName
,
'
:newGame
'
);
}
Socketio
.
emit
(
data
.
sessionName
+
"
:newGame
"
,
true
);
for (var key in endRound) {
socket
.
emit
(
data
.
sessionName
+
"
:newGame
"
,
true
);
socket.emit(key, endRound[key])
});
}*/
socket
.
on
(
"
newCard
"
,
data
=>
{
socket
.
on
(
"
newCard
"
,
data
=>
{
console
.
log
(
'
New Card from:
'
,
data
,
'
:newCard
'
);
console
.
log
(
'
New Card from:
'
,
data
.
sessionName
,
'
:newCard
'
);
currentCard
[
data
.
sessionName
+
"
:newCard
"
]
=
data
.
cardID
;
currentCard
[
data
.
sessionName
+
"
:newCard
"
]
=
data
.
cardID
;
Socketio
.
emit
(
data
.
sessionName
+
"
:newCard
"
,
data
.
cardID
)
Socketio
.
emit
(
data
.
sessionName
+
"
:newCard
"
,
data
.
cardID
)
});
});
socket
.
on
(
"
newRound
"
,
data
=>
{
socket
.
on
(
"
newRound
"
,
data
=>
{
console
.
log
(
'
New Round from:
'
,
data
.
isOpen
);
console
.
log
(
'
New Round from:
'
,
data
.
isOpen
);
endRound
[
data
.
sessionName
+
"
:endRound
"
]
=
false
;
Socketio
.
emit
(
data
.
sessionName
+
"
:endRound
"
,
false
);
Socketio
.
emit
(
data
.
sessionName
+
"
:endRound
"
,
false
);
socket
.
emit
(
data
.
sessionName
+
"
:endRound
"
,
false
);
socket
.
emit
(
data
.
sessionName
+
"
:endRound
"
,
false
);
newRound
[
data
.
sessionName
+
"
:newRound
"
]
=
true
;
Socketio
.
emit
(
data
.
sessionName
+
"
:newRound
"
,
true
);
Socketio
.
emit
(
data
.
sessionName
+
"
:newRound
"
,
true
);
socket
.
emit
(
data
.
sessionName
+
"
:newRound
"
,
true
);
socket
.
emit
(
data
.
sessionName
+
"
:newRound
"
,
true
);
Socketio
.
emit
(
data
.
sessionName
+
"
:newGame
"
,
false
);
socket
.
emit
(
data
.
sessionName
+
"
:newGame
"
,
false
);
});
});
socket
.
on
(
"
endRound
"
,
data
=>
{
socket
.
on
(
"
endRound
"
,
data
=>
{
console
.
log
(
'
End Round from:
'
,
data
.
isOpen
);
console
.
log
(
'
End Round from:
'
,
data
.
isOpen
);
newRound
[
data
.
sessionName
+
"
:newRound
"
]
=
false
;
Socketio
.
emit
(
data
.
sessionName
+
"
:newRound
"
,
false
);
Socketio
.
emit
(
data
.
sessionName
+
"
:newRound
"
,
false
);
socket
.
emit
(
data
.
sessionName
+
"
:newRound
"
,
false
);
socket
.
emit
(
data
.
sessionName
+
"
:newRound
"
,
false
);
endRound
[
data
.
sessionName
+
"
:endRound
"
]
=
true
;
Socketio
.
emit
(
data
.
sessionName
+
"
:endRound
"
,
true
);
Socketio
.
emit
(
data
.
sessionName
+
"
:endRound
"
,
true
);
socket
.
emit
(
data
.
sessionName
+
"
:endRound
"
,
true
);
socket
.
emit
(
data
.
sessionName
+
"
:endRound
"
,
true
);
});
});
...
...
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