this repo is no longer maintained. Moved to https://git.sr.ht/~fabiancodes/grahoot
the cli client can be installed via the python package index:
pip install grahoot-py
or with automatically managed environments
pipx install grahoot-py
- option not to use tls
- show live clock in client
- cleaner input handling in client
- make backend controlable through stdin/stdout
All data is exchanged via the JSON format because it's easy to use in python. TLS will be used by default.
client -> server:
{
"username": "<username>",
"game_pin": "<game_pin>"
}
server -> client:
{
"status": "<0 when successful; 1 otherwise>",
"message": "<descriptive message>"
}
server -> clients:
{
"message": "registration end"
}
server -> clients:
{
"title": "<title>",
"time": "<time_in_seconds>",
"points": "<points>",
"type": "single choice" | "multiple choice" | "guess number" | "guess string",
"options": [
{ "text": "<text>" },
...
], -- only used for single and multiple choice
"solution": "Index <indicies of correct choices comma separated>" | "Guess <correct number>" -- if type is not "guess string",
"solution": [
{ "text": "<possible solution>" },
...
], -- if type is "guess string"
"rad": "<radius to get points in>" -- this entry exists only for number guesses
}
client -> server:
{
"answer": "<answer>"
}
server -> clients:
{
"solution": "<solution>",
"score": "<new_user_score>"
}
server -> clients:
{
"message": "end"
}
This protocol gives the user the control over the server using it's stdin/stdout, which might be useful for remote control. For example, there could be a supervising process - acting as a server - responsible for multiple quizzes at once, giving the 'quiz master' the ability to start a quiz via a website or any other client.
controller will be C and server S
S: <game_pin>
C: ok
foreach new_user:
S: <new_user>
C: ok
C: end
S: ok
S: <num of participants>
C: ok
If an ok is expected but something else is received, "error" will be written to stdout.