Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enwtn/4-in-a-row
4 in a row / connect 4, in go and js
https://github.com/enwtn/4-in-a-row
browser-game connect4 go golang websockets
Last synced: 28 days ago
JSON representation
4 in a row / connect 4, in go and js
- Host: GitHub
- URL: https://github.com/enwtn/4-in-a-row
- Owner: enwtn
- License: mit
- Created: 2019-06-30T19:06:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-31T19:15:25.000Z (over 3 years ago)
- Last Synced: 2024-10-22T12:00:06.890Z (about 2 months ago)
- Topics: browser-game, connect4, go, golang, websockets
- Language: Go
- Homepage:
- Size: 78.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - 4-in-a-row
README
# 4-in-a-row
**Online in-browser multiplayer 4 in a row. Backend written in Go. Frontend in JavaScript.**
Uses websockets.**[Try it here.](https://connect4.nwtn.uk/)** (might not always be up.)
Can play with 2-6 players, though any more than 2 usually ends in a draw. Grid size customisation could fix this, but I haven't added it.
**This is designed to work behind a reverse proxy serving https, if you want to use it standalone or over http then you must change `wss://` to `ws://` in static/js/c4.js**
If used behind a reverse proxy you will get websocket errors unless you add the correct headers for location /ws.
Here is my config for nginx:location /ws {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;proxy_pass http://:8292;
proxy_redirect off;proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Should be easy for apache also.## Docker
To install:docker run \
-d \
--name connect4 \
-p 8292:8292 \
--restart unless-stopped \
en3wton/connect4
Port 8292 in the container must be published.