This is a simple Haskell websocket server for Kalevala using the websockets library. It pairs clients together, passes appropriate game start messages, forwards messages from clients to their opponents, and handles disconnections gracefully.
Installation is easiest with Stack. First install Stack if needed.
stack build
stack run
Or run with systemd
! Save the following definition to /etc/systemd/system/kalevala.service
:
[Unit]
Description=Kalevala websocket server
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
WorkingDirectory=/root/voluspa-server
ExecStart=stack run
[Install]
WantedBy=multi-user.target
Start it once with systemctl start kalevala
or enable it on startup with systemctl enable kalevala
.