2 KiB
2 KiB
The taClient.addUserToMatch() method
This documents the taClient.addUserToMatch() method.
info
Async: This is a method you would want to use await with
This method has input parameters. The function could easily be defined as:
async function addUserToMatch(tournamentId: string, matchId: string, userId: string): Promise<Response> {
// backend logic
}
tournamentId refers to the guid of the tournament, matchId is the guid of the match, and userId is the guid of the user.
General usage:
const response: Response = taClient.addUserToMatch(tournamentGuid, matchGuid, userGuid);
- For
Responseplease find documentation at Models -> Response
If you have not yet, please read Client -> Introduction to the Client
Standard Response:
{
details: {
updateMatch: Response_UpdateMatch,
oneofKind: 'updateMatch'
},
respondingToPacketId: 'packet-guid-uuidv4',
type: Response_ResponseType
}
- For
Response_UpdateMatchplease find documentation at Models -> Response_UpdateMatch.
An implmentation example:
// This method is called when we want to add ourselves to a match in order ro receive live score updates etc.
async function addSelfToMatch() {
// If we are not in the match already
if(!match?.associatedUsers.includes(client.stateManager.getSelfGuid())) {
// Add ourselves to the match
const response = await client.addUserToMatch(tournamentGuid, matchGuid, client.stateManager.getSelfGuid());
console.log("Added Self to match!", response);
}
}
info
Example: This is a direct example from ShyyTAUI. It comes from the matches page of tournaments.