Pongy is an application to help track ping pong games, designed to be used with flic buttons. It is comprised of a server connected to a client using WebSockets. Making requests to the server will result in messages being sent to the client which will then take some action.
To run both client and server locally with one command that watches for changes and reloads:
$ yarn run start:dev
You can also run the client and server separately:
$ yarn start # Start the client and watch for changes
$ yarn run start:server # Start the server (not in dev mode)
Each side of the ping pong table is assigned a button. Pressing the button makes a request to an endpoint which then updates the application accordingly.
The flic button is capable of recognizing three actions: click, double-click, and hold.
Button Press | Action |
---|---|
Single click | Record a point |
Double-click | Clear the last recorded point |
Hold | Start a new game |
- koa
- WebSockets
- mongoDB (possibly for future enhancements or to save a history)
Method | Path | Action |
---|---|---|
GET | /games/new | Create new game |
POST | /games/update | Update current game |
The POST endpoints expect a request body with the following format:
{
action: '' // {string} name of store action,
args: [], // {array} arguments to pass to action
}
- Overall score
- Which side has service
- Serve count
- Wall side (white) serves first
- Two points played per service
- Game played to 11
- If score reaches 10 - 10, match goes into deuce
- In deuce service alternates every point
- Must win by 2
- Support tournament play (Best of 5)