break: enhance server message structure and settings
- add explicit server messages for start and end
- include pomodoro setttings in server messages
- update README
🤖
This commit is contained in:
parent
b60df1c025
commit
a0dba673a2
5 changed files with 35 additions and 28 deletions
29
README.md
29
README.md
|
@ -55,23 +55,26 @@ Example:
|
|||
|
||||
### Server Messages
|
||||
|
||||
The server periodically (every second) sends JSON-encoded messages to all connected clients to update them on the current state of the Pomodoro session.
|
||||
These messages contain the following fields:
|
||||
The server periodically (every second) sends JSON-encoded messages to all connected clients to update them on the current state of the Pomodoro session. These messages contain the following fields:
|
||||
|
||||
- mode: Indicates the current phase of the Pomodoro session ("Work", "ShortBreak", "LongBreak", or empty if no session is running).
|
||||
- mode: Indicates the current phase of the Pomodoro session ("Work", "ShortBreak", "LongBreak", "End" or "Idle").
|
||||
- settings: Contains the current Pomodoro settings:
|
||||
- work: Length of the work session in seconds (e.g., 1500 for 25 minutes).
|
||||
- shortBreak: Length of the short break in seconds (e.g., 300 for 5 minutes).
|
||||
- longBreak: Length of the long break in seconds (e.g., 900 for 15 minutes).
|
||||
- sessions: The total number of work/break sessions (e.g., 4).
|
||||
- session: The current session number (e.g., 1 for the first work session).
|
||||
- total_sessions: The total number of sessions for the current Pomodoro cycle (e.g., 4 if the cycle consists of 4 work/break sessions).
|
||||
- time_left: The remaining time for the current mode, in seconds (e.g., 900 for 15 minutes).
|
||||
- ongoing: Wether a pomodoro is currently ongoing
|
||||
- paused: Wether the timer is paused
|
||||
- ongoing: Whether a Pomodoro session is currently ongoing.
|
||||
- paused: Whether the timer is paused.
|
||||
|
||||
| Message Type | Example |
|
||||
| --------------------- | --------------------------------------------------- |
|
||||
| Welcome Message | `{"mode": "", "session":0, "total_sessions":0, "time_left":0, "ongoing": false, "paused": false}` |
|
||||
| Session Running | `{"mode": "Work", "session": 1, "total_sessions": 4, "time_left": 900, "ongoing": true, "paused": false}` |
|
||||
| Session Running | `{"mode": "ShortBreak", "session": 2, "total_sessions": 4, "time_left": 50, "ongoing": true, "paused": false}` |
|
||||
| Session Paused | `{"mode": "Work", "session": 2, "total_sessions": 4, "time_left": 456, "ongoing": true, "paused": true}` |
|
||||
| Session End/Reset | `{"mode": "", "session": 0, "total_sessions": 0, "time_left": 0, "ongoing": false, "paused": false}` |
|
||||
| Message Type | Example |
|
||||
| --- | --- |
|
||||
| Welcome Message | {"mode":"Idle", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":1500, "ongoing":false, "paused":false} |
|
||||
| Session Running | {"mode":"Work", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":1, "time_left":900, "ongoing":true, "paused":false} |
|
||||
| Session Running | {"mode":"ShortBreak", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":50, "ongoing":true, "paused":false} |
|
||||
| Session Paused | {"mode":"Work", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":456, "ongoing":true, "paused":true} |
|
||||
| Session End/Reset | {"mode":"End", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":0, "ongoing":false, "paused":false} |
|
||||
|
||||
## Testing
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue