gpomo-server

command module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2023 License: BSD-3-Clause Imports: 20 Imported by: 0

README

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

Using the Go toolchain

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.

Documentation

Overview

Package main is the core gpomo server.

Directories

Path Synopsis
internal
config
Package config is for working with the configuration file and options.
Package config is for working with the configuration file and options.
notify
Package notify manages notifications through libnotify.
Package notify manages notifications through libnotify.
pkg
pomodo
Package pomodo manages the pomodo timer.
Package pomodo manages the pomodo timer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL