Functions that connect the client code to the server.
Make a client connection to a proxy server.
No WebSocket connection will be used to send messages.
Simulate a round-trip through the message encoder, decoder, and message processor.
Returns a function that takes a request message, encodes it, decodes it, processes it into a response, encodes and decodes that, then returns the result.
Usually passed as the first arg to makeProxyServer.
Return a Cmd to send a message through a server interface.
Return the server URL from inside a ServerInterface.
Check that the passed GameId is in the ServerState's game dict.
If it is, return the gamestate. Otherwise wrap the message in an ErrorRsp.
Check that the passed GameId is in the ServerState's game dict and that it satisifed the ModeChecker.
If it does, return the gamestate. Otherwise wrap the message in an ErrorRsp.
Check that the passed PlayerId is in the ServerState's player dict.
If it is, return the PlayerInfo record for the player.
Otherwise wrap the message in an ErrorRsp.
"<gameid>"
Add a game to a ServerState.
Adds the game ID to the added games list in ServerState.changes, so that the server code will update its tables.
Add a player to a ServerState.
Adds the player ID to the added players list in ServerState.changes, so that the server code will update its tables.
Remove a game and its players from a ServerState.
Adds the game ID to the removed games list in ServerState.changes, so that the server code will update its tables.
Remove a player from a ServerState.
Adds the player ID to the removed players list in ServerState.changes, so that the server code will update its tables.
Push a PublicGame onto a list of them.
Remove the PublicGame with the given GameId from a list of games.
Generate a random GameId string, ensuring that it is not already assigned to a game.
Will not be used by servers that have no concept of a game.
Generate a random PlayerId string, ensuring that it is not already assigned to a player.
Will not be used by servers that have no concept of a player.
Look up the gamestate for a GameId
Update the gamestate for a GameId.
Use removeGame to delete a game.
Return the total number of games.
Look up the PlayerInfo for a PlayerId
Update the PlayerInfo for a PlayerId.
Use removePlayer to delete a player.
Get the player IDs for a game ID.
Return true if the GameId is in the public games list.
Return true if the GameId is NOT in the public games list.
Create the ErrorRsp record returned in the errors from CheckOnlyGameid, checkGameid, and checkPlayerid.
Make a client connection to a real WebSocket server.
The
msgwill usually be a no-operation message. It is only used to fill a slot in the returnedServerInterface. That slot is only used by the proxy server.