API for a game of Ludo
You need the following package to use this API.
npm install @aspnet/signalr@next
The API is live on ludo.azurewebsites.net
Connect on subpath /game
- invoke
lobby:createwithlobbyNameto create a new lobby - invoke
lobby:joinwithlobbyNameto join a created lobby - invoke
lobby:leaveto leave your currently joined lobby - invoke
lobby:readyto inform your mates you're ready to roll - invoke
lobby:get-playerswithlobbyNameto get the players in said lobby - invoke
lobby:get-lobbiesto get the lobbies names - invoke
lobby:existswithlobbyNameto check whether a lobby with that name already exists
When you're in a lobby you can get events for said lobby
- on
lobby:player-joinit returns the user details of the player that joined - on
lobby:player-leaveit returns the user identifier for the player that left - on
lobby:player-readyit returns the player identifier of the player who is ready to start the game
- invoke
game:startas admin (those who created the lobby) to start the game when everyone is ready - invoke
game:roll-dieto roll your dice if it's your turn - invoke
game:advancewithpieceIndexto move the piece
When you're in a started game you can get events for that game
- on
game:startedthe game has started - on
game:die-rolla player has rolled the dice, it returns the player identifier of the player who rolled the die and the amount it rolled - on
game:advanceda player has advanced his piece, it returns the player identifier of the player who advanced his piece and the index of said piece - on
game:next-turnthe next player or turn starts, it returns the player identifier of the player whose turn it is and the turn type (roll or advance)