|
|
|
@ -34,17 +34,17 @@ Here are the available commands:
|
|
|
|
|
| `pause` | Pauses the current session | `{"command": "pause", "password": ""}` |
|
|
|
|
|
| `resume` | Resumes a paused session | `{"command": "resume", "password": ""}` |
|
|
|
|
|
| `reset` | Stops and resets the current session | `{"command": "reset", "password": ""}` |
|
|
|
|
|
| `updateSettings` | Update Pomodoro settings | `{"command": "updateSettings", "password": "", "settings": {"focus": 600, "shortBreak": 60, "longBreak": 300, "sessions": 2}}` |
|
|
|
|
|
| `updateSettings` | Update Pomodoro settings | `{"command": "updateSettings", "password": "", "settings": {"work": 600, "shortBreak": 60, "longBreak": 300, "sessions": 2}}` |
|
|
|
|
|
|
|
|
|
|
#### Update Settings Command (`updateSettings`)
|
|
|
|
|
|
|
|
|
|
The `updateSettings` command allows clients to modify the Pomodoro timer configuration, including the length of focus sessions, short breaks, long breaks, and the total number of sessions in a cycle. This command must include a valid password to be accepted by the server. The updateSettings command can be used when the timer is stopped.
|
|
|
|
|
The `updateSettings` command allows clients to modify the Pomodoro timer configuration, including the length of work sessions, short breaks, long breaks, and the total number of sessions in a cycle. This command must include a valid password to be accepted by the server. The updateSettings command can be used when the timer is stopped.
|
|
|
|
|
|
|
|
|
|
- Fields in the `settings` Object:
|
|
|
|
|
- `focus`: Length of the focus session (in seconds).
|
|
|
|
|
- `work`: Length of the work session (in seconds).
|
|
|
|
|
- `shortBreak`: Length of the short break (in seconds).
|
|
|
|
|
- `longBreak`: Length of the long break (in seconds).
|
|
|
|
|
- `sessions`: Total number of focus/break sessions in the Pomodoro cycle.
|
|
|
|
|
- `sessions`: Total number of work/break sessions in the Pomodoro cycle.
|
|
|
|
|
|
|
|
|
|
All fields are mandatory and may not be ommitted.
|
|
|
|
|
|
|
|
|
@ -55,11 +55,11 @@ The server periodically (every second) sends JSON-encoded messages to all connec
|
|
|
|
|
- mode: Indicates the current phase of the Pomodoro session ("Focus", "ShortBreak", "LongBreak", "End" or "Idle").
|
|
|
|
|
- "End" is send only once, after all sessions are finished
|
|
|
|
|
- settings: Contains the current Pomodoro settings:
|
|
|
|
|
- focus: Length of the focus session in seconds (e.g., 1500 for 25 minutes).
|
|
|
|
|
- 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 focus/break sessions (e.g., 4).
|
|
|
|
|
- session: The current session number (e.g., 1 for the first focus session).
|
|
|
|
|
- sessions: The total number of work/break sessions (e.g., 4).
|
|
|
|
|
- session: The current session number (e.g., 1 for the first work session).
|
|
|
|
|
- time_left: The remaining time for the current mode, in seconds (e.g., 900 for 15 minutes).
|
|
|
|
|
- ongoing: Whether a Pomodoro session is currently ongoing.
|
|
|
|
|
- paused: Whether the timer is paused.
|
|
|
|
@ -67,11 +67,11 @@ The server periodically (every second) sends JSON-encoded messages to all connec
|
|
|
|
|
|
|
|
|
|
| Message Type | Example |
|
|
|
|
|
| --- | --- |
|
|
|
|
|
| Welcome Message | {"mode":"Idle", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":1500, "ongoing":false, "paused":false, "version":"0"} |
|
|
|
|
|
| Session Running | {"mode":"Focus", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":1, "time_left":900, "ongoing":true, "paused":false, "version":"0"} |
|
|
|
|
|
| Session Running | {"mode":"ShortBreak", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":50, "ongoing":true, "paused":false, "version":"0"} |
|
|
|
|
|
| Session Paused | {"mode":"Focus", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":456, "ongoing":true, "paused":true, "version":"0"} |
|
|
|
|
|
| Session End/Reset | {"mode":"End", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":0, "ongoing":false, "paused":false, "version":"0"} |
|
|
|
|
|
| Welcome Message | {"mode":"Idle", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":1500, "ongoing":false, "paused":false, "version":"0"} |
|
|
|
|
|
| Session Running | {"mode":"Focus", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":1, "time_left":900, "ongoing":true, "paused":false, "version":"0"} |
|
|
|
|
|
| Session Running | {"mode":"ShortBreak", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":50, "ongoing":true, "paused":false, "version":"0"} |
|
|
|
|
|
| Session Paused | {"mode":"Focus", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":456, "ongoing":true, "paused":true, "version":"0"} |
|
|
|
|
|
| Session End/Reset | {"mode":"End", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":0, "ongoing":false, "paused":false, "version":"0"} |
|
|
|
|
|
|
|
|
|
|
## Testing
|
|
|
|
|
|
|
|
|
|