Lightweight WebSocket game server built with Rust, designed for managing multiplayer game sessions with real-time scoring.
Start the server:
cargo run
The server will start on localhost:3001
GET /health
- Health check endpointGET /ws
- WebSocket connection endpoint
- Create Game
{
"event": "createGame",
"playerName": "Player1"
}
- Join Game
{
"event": "joinGame",
"code": "GAMECODE",
"playerName": "Player2"
}
- Start Game
{
"event": "startGame"
}
- Submit Solution
{
"event": "submitSolution",
"usedHint": false
}
- Game Created
{
"event": "gameCreated",
"gameCode": "ABC123"
}
- Player Joined
{
"event": "playerJoined",
"players": [
{"name": "Player1", "score": 0},
{"name": "Player2", "score": 0}
]
}
- Game Started
{
"event": "gameStarted"
}
- Scores Updated
{
"event": "updateScores",
"players": [
{"name": "Player1", "score": 1},
{"name": "Player2", "score": 0}
]
}