-
Notifications
You must be signed in to change notification settings - Fork 0
/
asyncapi.yaml
86 lines (78 loc) · 1.92 KB
/
asyncapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
asyncapi: 2.4.0
info:
title: Tic Tac Toe WebSocket API
version: 1.0.0
description: This API allows real-time interaction in a Tic Tac Toe game via WebSockets.
contact:
name: masechkacat
url: 'https://www.mt-dev.online/'
email: masechkacat@gmail.com
servers:
local:
url: ws://localhost:3000
protocol: ws
description: Local development server for Tic Tac Toe.
channels:
'/':
subscribe:
summary: Receive updates from the server, including game state and messages.
message:
oneOf:
- $ref: '#/components/messages/GameUpdate'
- $ref: '#/components/messages/Message'
- $ref: '#/components/messages/GameOver'
- $ref: '#/components/messages/Error'
publish:
summary: Send moves to the server.
message:
$ref: '#/components/messages/Move'
components:
messages:
GameUpdate:
payload:
type: object
properties:
result:
type: object
properties:
status:
type: string
enum: ['continue', 'win', 'draw']
board:
type: array
items:
type: string
nullable: true
enum: [null, 'X', 'O']
currentPlayer:
type: string
playerIds:
type: array
items:
type: string
Message:
payload:
type: object
properties:
text:
type: string
GameOver:
payload:
type: object
properties:
text:
type: string
Move:
payload:
type: object
properties:
index:
type: integer
minimum: 0
maximum: 8
Error:
payload:
type: object
properties:
message:
type: string