Gpomo
Gpomo is a pomodoro timer built using a client and server model. This allows for various frontends to be developed to
interact with the server. Communication between the client and the server is handled through a WebSocket connection.
This document covers interacting with the server.
Installing
To install using the Go tool chain, which will result in the file being put in $GOPATH/bin
run the following
command:
go install git.sr.ht/~vendion/gpomo-server@latest
This will install the latest released version, to install a specific version replace latest
with a specific git
tag.
Interacting with the server
Connecting to the server (Debugging purposes)
When trying to debug the connection or specific commands, it is possible to get verbose output by connecting using
a tool like wscat
.
wscat --connect ws://localhost:<port>
Note: Currently the server will use a random port when ran so make sure to check its output to get the correct port
information.
Sending commands
Commands are sent to the server as JSON strings using the following format:
{"mode":"<command>"}
The server uses a connection poll, this means it sends its output to all currently subscribed clients as well as can
receive the commands from any connected client.
Commands
Currently the following commands are supported.
is-ticking
This command reports if there is a timer currently running. This is useful when the client first connects to the
server.
> {"mode":"is-ticking"}
< {"ticking":false}
ticker
This command subscribes the client to receive updates from the server. This is useful when is-ticking
reports
that there is a timer running.
> {"mode":"ticker"}
Note: In order to subscribe the client to receive updates from the server, this command needs to be sent from a
dedicated connection to the server, and any commands sent to the server will need to be sent using another
connection.
start
This command starts a new timer and if needed subscribes the client to receive updates from the server.
> {"mode":"start"}
stop
This command stops the currently running timer.
> {"mode":"stop"}
close
This command unsubscribes the client and closes the connection.
> {"mode":"close"}
License
gpomo
is licensed under the BSD 3-Clause "New" or "Revised" License.