2025-02-16 20:56:43 +01:00
|
|
|
asyncapi: 3.0.0
|
|
|
|
info:
|
|
|
|
title: Game Server
|
|
|
|
version: 0.0.1
|
|
|
|
description: |
|
|
|
|
This is the Websocket Specification for the Tower Defence Game. <br>
|
|
|
|
Because of the limitations of Async API, we expect that the actual json,
|
2025-02-26 13:26:58 +01:00
|
|
|
which is send as payload to always contain a field called `$id` with
|
2025-02-16 20:56:43 +01:00
|
|
|
the corresponding `messageId`. <br>
|
|
|
|
The `messageId` should be handled case sensitive.
|
|
|
|
defaultContentType: application/json
|
|
|
|
servers:
|
|
|
|
localhost:
|
|
|
|
host: localhost:8080
|
|
|
|
protocol: ws
|
|
|
|
pathname: /ws
|
|
|
|
security:
|
|
|
|
- $ref: "#/components/securitySchemes/JwtAuth"
|
|
|
|
|
|
|
|
channels:
|
|
|
|
connection:
|
|
|
|
title: Connection
|
|
|
|
description: |
|
|
|
|
The Base Channel used for:
|
|
|
|
- Authentication
|
|
|
|
- Receiving Tokens for other channels
|
|
|
|
- Reconnection
|
|
|
|
messages:
|
|
|
|
RequestConnectionToken:
|
|
|
|
description: |
|
|
|
|
A Message telling the Server, that
|
|
|
|
you want an Connection Token for a
|
|
|
|
Specific Channel
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
channel:
|
2025-02-19 11:38:00 +01:00
|
|
|
$ref: "#/components/schemas/Channel"
|
2025-02-16 20:56:43 +01:00
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- channel
|
|
|
|
ProvidedConnectionToken:
|
|
|
|
description: |
|
|
|
|
A Message telling the Server, that
|
|
|
|
you want an Connection Token for a
|
|
|
|
Specific Channel
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
channel:
|
2025-02-19 11:38:00 +01:00
|
|
|
$ref: "#/components/schemas/Channel"
|
2025-02-16 20:56:43 +01:00
|
|
|
token:
|
|
|
|
$ref: "#/components/schemas/JWT"
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- channel
|
|
|
|
- token
|
2025-02-19 11:38:00 +01:00
|
|
|
|
|
|
|
matchmaking:
|
|
|
|
title: Matchmaking
|
2025-03-05 11:39:47 +01:00
|
|
|
description: |
|
2025-02-19 11:38:00 +01:00
|
|
|
A Channel used to search for a match and
|
|
|
|
to receive one
|
|
|
|
messages:
|
|
|
|
MatchSetSearchState:
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
searching:
|
|
|
|
type: boolean
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- searching
|
|
|
|
MatchFound:
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
matchId:
|
|
|
|
type: string
|
|
|
|
created:
|
|
|
|
description: "Unix Timestamp describing when this Match was found"
|
|
|
|
type: integer
|
|
|
|
format: int64
|
|
|
|
ttl:
|
|
|
|
description: "Time in Milliseconds, how long this Match is open for accepting"
|
|
|
|
type: integer
|
|
|
|
format: int64
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- matchId
|
|
|
|
- created
|
|
|
|
- ttl
|
|
|
|
MatchAccepted:
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
matchId:
|
|
|
|
type: string
|
|
|
|
accepted:
|
|
|
|
type: boolean
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- matchId
|
|
|
|
- accepted
|
|
|
|
MatchAborted:
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
matchId:
|
|
|
|
type: string
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- matchId
|
|
|
|
MatchEstablished:
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
matchId:
|
|
|
|
type: string
|
|
|
|
opponentName:
|
|
|
|
type: string
|
2025-03-05 11:39:47 +01:00
|
|
|
token:
|
|
|
|
$ref: "#/components/schemas/JWT"
|
2025-02-19 11:38:00 +01:00
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- matchId
|
|
|
|
- opponentName
|
2025-03-05 11:39:47 +01:00
|
|
|
- token
|
2025-02-19 11:38:00 +01:00
|
|
|
|
2025-03-05 11:39:47 +01:00
|
|
|
match:
|
|
|
|
title: Match
|
2025-02-16 20:56:43 +01:00
|
|
|
description: |
|
2025-03-05 11:39:47 +01:00
|
|
|
Channel for managing an active match
|
2025-02-16 20:56:43 +01:00
|
|
|
messages:
|
2025-03-10 13:39:14 +01:00
|
|
|
RequestTowerPlacing:
|
|
|
|
description: Requesting a placement of a tower
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
x:
|
|
|
|
type: integer
|
|
|
|
y:
|
|
|
|
type: integer
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- x
|
|
|
|
- y
|
|
|
|
TowerPlaced:
|
|
|
|
description: A tower was placed
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
x:
|
|
|
|
type: integer
|
|
|
|
y:
|
|
|
|
type: integer
|
|
|
|
map:
|
|
|
|
type: string
|
|
|
|
enum:
|
|
|
|
- player
|
|
|
|
- opponent
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- x
|
|
|
|
- y
|
|
|
|
- map
|
|
|
|
InvalidPlacement:
|
|
|
|
description: A tower was placed
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
x:
|
|
|
|
type: integer
|
|
|
|
y:
|
|
|
|
type: integer
|
|
|
|
reason:
|
|
|
|
type: string
|
|
|
|
enum:
|
|
|
|
- "out-of-bounds"
|
|
|
|
- "location-used"
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- x
|
|
|
|
- y
|
|
|
|
- reason
|
2025-03-12 12:15:25 +01:00
|
|
|
PlayerMoney:
|
|
|
|
description: Money a player currently has
|
|
|
|
payload:
|
|
|
|
type: object
|
|
|
|
additionalProperties: false
|
|
|
|
properties:
|
|
|
|
$id:
|
|
|
|
type: string
|
|
|
|
format: messageId
|
|
|
|
playerMoney:
|
|
|
|
type: integer
|
|
|
|
required:
|
|
|
|
- $id
|
|
|
|
- playerMoney
|
|
|
|
|
2025-02-16 20:56:43 +01:00
|
|
|
|
|
|
|
operations:
|
|
|
|
requestConnectionToken:
|
|
|
|
title: RequestConnectionToken
|
|
|
|
action: send
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/connection"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/connection/messages/RequestConnectionToken"
|
|
|
|
reply:
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/connection"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/connection/messages/ProvidedConnectionToken"
|
2025-02-19 11:38:00 +01:00
|
|
|
searchMatch:
|
|
|
|
title: SearchMatch
|
|
|
|
action: send
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/matchmaking"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/matchmaking/messages/MatchSetSearchState"
|
2025-02-26 13:26:58 +01:00
|
|
|
setPlayerMatchSearching:
|
|
|
|
title: SetPlayerMatchSearching
|
|
|
|
action: receive
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/matchmaking"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/matchmaking/messages/MatchSetSearchState"
|
2025-02-19 11:38:00 +01:00
|
|
|
foundMatch:
|
|
|
|
title: FoundGame
|
|
|
|
action: receive
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/matchmaking"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/matchmaking/messages/MatchFound"
|
|
|
|
reply:
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/matchmaking"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/matchmaking/messages/MatchAccepted"
|
|
|
|
abortedMatch:
|
|
|
|
title: AbortedMatch
|
|
|
|
action: receive
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/matchmaking"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/matchmaking/messages/MatchAborted"
|
|
|
|
establishedMatch:
|
|
|
|
title: EstablishedMatch
|
|
|
|
action: receive
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/matchmaking"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/matchmaking/messages/MatchEstablished"
|
2025-03-10 13:39:14 +01:00
|
|
|
towerPlacing:
|
|
|
|
title: TowerPlacing
|
|
|
|
action: send
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/match"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/match/messages/RequestTowerPlacing"
|
|
|
|
reply:
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/match"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/match/messages/TowerPlaced"
|
|
|
|
- $ref: "#/channels/match/messages/InvalidPlacement"
|
|
|
|
enemyPlacedTower:
|
|
|
|
title: EnemyPlacedTower
|
|
|
|
action: receive
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/match"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/match/messages/TowerPlaced"
|
2025-03-12 12:15:25 +01:00
|
|
|
playerMoney:
|
|
|
|
title: PlayerMoney
|
|
|
|
action: receive
|
|
|
|
channel:
|
|
|
|
$ref: "#/channels/match"
|
|
|
|
messages:
|
|
|
|
- $ref: "#/channels/match/messages/PlayerMoney"
|
2025-03-10 13:39:14 +01:00
|
|
|
|
|
|
|
|
2025-02-16 20:56:43 +01:00
|
|
|
|
|
|
|
components:
|
|
|
|
securitySchemes:
|
|
|
|
JwtAuth:
|
|
|
|
name: Authorization
|
|
|
|
description: |
|
|
|
|
A JWT Token has to be provided in the Handshake Header. <br>
|
|
|
|
This Field is expected to be called `Authorization`. <br>
|
|
|
|
It is expected to not have a prefix like `bearer`.
|
|
|
|
type: httpApiKey
|
|
|
|
in: header
|
|
|
|
schemas:
|
|
|
|
JWT:
|
|
|
|
type: string
|
|
|
|
format: jwt
|
2025-02-19 11:38:00 +01:00
|
|
|
Channel:
|
|
|
|
type: string
|
|
|
|
enum:
|
|
|
|
- matchmaking
|