Manage the users games list.
The coordinator module will:
- create game IDs
- maintain the list of ongoing games for a user
- assign a game to a server URL
COUCH_GAMES_PORT_5984_TCP_ADDR
- IP of the games couchdbCOUCH_GAMES_PORT_5984_TCP_PORT
- Port of the games couchdbREDIS_AUTH_PORT_6379_TCP_ADDR
- IP of the AuthDB redisREDIS_AUTH_PORT_6379_TCP_PORT
- Port of the AuthDB redisNOTIFICATIONS_PORT_8080_TCP_ADDR
- IP of the notifications serviceNOTIFICATIONS_PORT_8080_TCP_PORT
- Port of the notifications serviceGAME_SERVERS_URL
- Comma separated list of serversAPI_SECRET
- Give access to private APIs
All requests made to the coordinator API require an auth token, passed in the request URL.
+ Parameters
+ token (string) ... User authentication token
+ id (string) ... ID of the game
{
"id": "ab12345789",
"type": "triominos/v1",
"players": [ "some_username_1", "some_username_2" ],
"status": "active",
"url": "http://ganomede.fovea.cc:43301",
"gameOverData": { ... only if status is "gameover" ... }
"waiting": [ "some_username_2" ] ... only if status is "inactive"
}
Possible status
:
inactive
active
gameover
When status is inactive
, waiting
will contains the list of username that didn't activate the game.
{
"id": "ab12345789",
"type": "triominos/v1",
"players": [ "some_username_1", "some_username_2" ],
"status": "inactive",
"url": "http://ganomede.fovea.cc:43301",
"waiting": [ "some_username_2" ] ... only if status is "inactive"
}
- This is only allowed for inactive games, when called by a "waiting" user.
- Will reply with status 403 otherwise.
status
will change toactive
when there is no more waiting players.- a notification will be sent to other active players (that aren't in the waiting list)
(optional)
{
"reason": "resign"
}
{
"id": "ab12345789",
"type": "triominos/v1",
"players": [ "some_username_1", "some_username_2" ],
"status": "inactive",
"url": "http://ganomede.fovea.cc:43301",
"waiting": [ "some_username_2" ] ... only if status is "inactive"
}
- This is only allowed when called by a non waiting user.
- Will reply with status 403 otherwise.
status
will change toinactive
- a notification will be sent to other active players.
{
"gameOverData": { ... }
}
- This is only allowed when called by a non waiting user.
- Will reply with status 403 otherwise.
status
will change toinactive
+ Parameters
+ token (string) ... User authentication token
List all the "active" games of the authenticated player.
[{
"id": "1234",
"type": "triominos/v1",
"players": [ "some_username", "other_username" ]
}, {
"id": "1235",
"type": "triominos/v1",
"players": [ "some_username", "amigo" ],
}]
+ Parameters
+ token (string) ... User authentication token
{
"players": [ "some_username_1", "some_username_2" ]
}
{
"id": "1234",
"type": "triominos/v1",
"players": [ "some_username", "other_username" ],
"status": "inactive",
"url": "http://ganomede.fovea.cc:43301"
}
Only when status set to "active", the game will appear in the games collection of both player.
Until then, it's waiting for activation... Hopefully it should be listed in the players' invitations.
Inactive games will have an expiry date of 1 month.
+ Parameters
+ secret (string) ... API secret code opening access to this call
+ since (string) ... Last sequence number known of
{
"result": [{
"seq":26,
"id": "1234",
"type": "triominos/v1",
"players": [ "some_username", "other_username" ],
"status": "gameover",
"gameOverData": { ... }
}, {
"seq":33,
"id": "1236",
"type": "triominos/v1",
"players": [ "some_username", "other_username" ],
"status": "gameover",
"gameOverData": { ... }
}],
"last_seq":39
}
seq
: The update sequence number.id
: The document ID.changes
: An array of fields, which by default includes the document’s revision ID, but can also include information about document conflicts and other things.