Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kus-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Кубота
kus-admin
Commits
58bf2c9d
Commit
58bf2c9d
authored
Jul 05, 2020
by
Иван Кубота
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
connected event
parent
bee4f43b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
api.js
api.js
+4
-1
monitor.html
public/monitor.html
+6
-2
No files found.
api.js
View file @
58bf2c9d
...
@@ -112,7 +112,10 @@ const wss = new WebSocket.Server({
...
@@ -112,7 +112,10 @@ const wss = new WebSocket.Server({
// should not be compressed.
// should not be compressed.
}
}
});
});
console
.
log
(
'WS LISTEN port: '
+
env
.
WS_PORT
)
wss
.
on
(
'connection'
,
function
connection
(
ws
)
{
ws
.
send
(
JSON
.
stringify
({
type
:
'connected'
,
data
:
null
}));
});
console
.
log
(
'WS LISTEN port: '
+
env
.
WS_PORT
);
global
.
log
=
function
(
type
,
data
){
global
.
log
=
function
(
type
,
data
){
try
{
try
{
wss
.
clients
.
forEach
(
function
each
(
client
)
{
wss
.
clients
.
forEach
(
function
each
(
client
)
{
...
...
public/monitor.html
View file @
58bf2c9d
...
@@ -57,10 +57,10 @@
...
@@ -57,10 +57,10 @@
padding
:
4px
;
padding
:
4px
;
border-bottom
:
1px
solid
#ccc
;
border-bottom
:
1px
solid
#ccc
;
}
}
.correct
{
.
question.
correct
{
background
:
#62ac6e
;
background
:
#62ac6e
;
}
}
.incorrect
{
.
question.
incorrect
{
background
:
#ac6862
;
background
:
#ac6862
;
}
}
</style>
</style>
...
@@ -95,7 +95,11 @@
...
@@ -95,7 +95,11 @@
log
=
document
.
querySelectorAll
(
'.log'
)[
0
];
log
=
document
.
querySelectorAll
(
'.log'
)[
0
];
var
attemptsHash
=
{},
var
attemptsHash
=
{},
questionsHashGlobal
=
{};
questionsHashGlobal
=
{};
var
actions
=
{
var
actions
=
{
connected
:
function
(
data
){
D
.
div
({
cls
:
'msg'
,
renderTo
:
log
},
D
.
span
({
cls
:
'msg-bold'
},
'Connected'
));
},
answerQuiz
:
function
(
data
){
answerQuiz
:
function
(
data
){
questionsHashGlobal
[
data
.
question
.
id
].
el
.
className
=
'question '
+
(
data
.
question
.
correct
?
'correct'
:
'incorrect'
)
questionsHashGlobal
[
data
.
question
.
id
].
el
.
className
=
'question '
+
(
data
.
question
.
correct
?
'correct'
:
'incorrect'
)
/*
/*
...
...
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