Connect Four Master Server
A REST API to connect all the Connect Four players together from all over the world.
- Web-based game browser interface with filtering capabilities
- Ability to view every single game ever played
- IP / name / version / status
- Which player has won if the game is finished
- When the game has been created, started and finished
- REST API used by the Connect Four game itself to advertise hosts and keep online game's data up-to-date
- Should work on any Python 3.x version. Feel free to test with another Python version and give me feedback
- A uWSGI-capable web server (optional, but recommended)
- Clone this repo somewhere
pip install -r requirements.txt
export FLASK_APP=cfms.py(Windows users:
flask create_database(WARNING: don't re-run this command unless you want to start from scratch, it will wipe out all the data)
config.example.py file to
config.py and fill in the configuration parameters.
Available configuration parameters are:
SECRET_KEYSet this to a complex random value
DEBUGEnable/disable debug mode
More informations on the three above can be found here.
GAMES_TTLGrace time (or time to live), in minutes, of the games who don't have the
I'll let you search yourself about how to configure a web server along uWSGI.
Run the internal web server, which will be accessible at
Edit this file and change the interface/port as needed.
The uWSGI file you'll have to set in your uWSGI configuration is
uwsgi.py. The callable is
You'll probably have to hack with this application to make it work with one of the solutions described here. Send me a pull request if you make it work.
A Flask command (
flask clean) is used to clean the database. It removes old games with a status different from
which have their latest ping older than now minus 5 minutes (by default). It should be ran by a Cron or some task scheduler
i.e every one minute, but this isn't mandatory.
Please navigate here for the full docs.
How it works
For more information, I suggest you do dive into the code starting with the
- This project uses GeoLite2 data created by MaxMind, available from www.maxmind.com
- Some good parts of the OpenRA Master Server inspired me
- Connect Four™ is a trademark of Milton Bradley / Hasbro. This project isn't supported nor endorsed by Milton Bradley / Hasbro
If you have questions or problems, you can submit an issue.
You can also submit pull requests. It's open-source man!