Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
teknikattan-scoring-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tddd96-grupp1
teknikattan-scoring-system
Commits
9cf576e0
Commit
9cf576e0
authored
3 years ago
by
Victor Löfgren
Browse files
Options
Downloads
Patches
Plain Diff
Update backend documentation
parent
95f583cf
No related branches found
Branches containing commit
No related tags found
1 merge request
!159
Resolve "Documentation"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/source/overview/server.md
+15
-9
15 additions, 9 deletions
docs/source/overview/server.md
with
15 additions
and
9 deletions
docs/source/overview/server.md
+
15
−
9
View file @
9cf576e0
...
@@ -54,22 +54,28 @@ In this way, for example, an entire competition with it's teams, codes, slides a
...
@@ -54,22 +54,28 @@ In this way, for example, an entire competition with it's teams, codes, slides a
## Active competitions
## Active competitions
Slides
,
timers and answers needs to be synced during an active presentation.
Slides
and
timers
(
and answers
)
needs to be synced during an active presentation.
This is done using SocketIO together with flask_socketio.
This is done using SocketIO together with flask_socketio.
Events sent is also authorized via json web tokens.
Events sent is also authorized via JWT, basically the same way as the for the API calls.
But for socket events, the decorator that is used to authenticate them is
`@authorize_user()`
.
Whenever client joins a competition they will connect via sockets.
Whenever client joins a competition they will connect via sockets.
Only a single instance of a competition can be active at a time.
A single competition cannot be active more than once at the same time.
This means that you will need to make a copy of a competition if you want to run multiple times at the same time.
All of the functionality related to an active competition and sockets can be found in the file
`app/core/sockets.py`
.
All of the functionality related to an active competition and sockets can be found in the file
`app/core/sockets.py`
.
The terms
`active competition`
and
`presentation`
means the same thing.
### Starting and joing presentations
### Starting and joing presentations
Whenever a client types in a code in the client, the code will be checked via the
`api/auth/login/code`
API call.
Whenever a client types in a code in the client it will be checked via the
`api/auth/login/code`
API call.
If there is such a code and it was an operator code, the client will receive a JWT it will need to use to authenticate itself for there on out.
If there is such a code and it was an operator code, the client will receive a JWT it will need to use to authenticate itself.
It will also emit the
`start_presentation`
event to start the presentation.
If there is such a code and the associated competition is active, the client will also receive a JWT, regardless if it was an operator code or not.
If there is such a code and the associated competition is active, the client will also receive a JWT, regardless if it was an operator code or not.
In this case the client will instead emit the
`join_presentation`
event.
Both of these cases will be handled by the default
`connect`
event, using the JWT received from the API call.
The server can see what is stored in the JWT and do different things depending on it's contents.
### Syncing between clients
### Syncing between clients
The operator will emit
`set_slide`
and
`set_timer`
events that syncs their slides and timers between all clients connected to the same presentation.
The operator will emit the
`sync`
event and provide either slide or timer to update it on the server.
The operator can also emit
`end_presentation`
to end the current presentation, which will disconnect all connected clients.
The server will then send
`sync`
to all connected clients with the updated values, regardless of what was actually updated.
The server will also store the timer and active slide in order to
`sync`
clients when they join.
The operator can also emit
`end_presentation`
to disconnect all clients from it's competitions.
This will also end the presentation.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment