EVENT NAMING CONVENTION
A-B-C A: room / rooms / HOBULHO / …
TERMS
ATTACK A가 B에게 카드를 통해 공격함
DEFEND::JUDGE 수비자가 공격자의 선언에 대해 참/거짓을 판단함
DEFEND::TOSS::ATTACK 수비자가 다른 플레이어를 향해 공격함
방 생성하기
// event: room-create-req
{
"userId": "id of user",
"roomName": "name of room to create",
"isLocked": "false",
"roomPw": "password of room to create",
"gameId": "id of game to play",
"roomSize": {
"min": "min number of players",
"max": "max number of players"
}
}
// event: room-create-resp
{
"response": {
"success": "false",
"error": {
"code": "1",
"message": "Memory limit exceeded" // util.inspect(process.memoryUsage())
}
},
"roomId": "id of room created",
"roomName": "name of room created",
"host": "id of user created room"
"isLocked": "false",
"roomPw": "password of room created",
"gameId": "id of game to play",
"headcount": "1",
"roomSize": {
"min": "min number of players",
"max": "max number of players"
}
}
방 참여하기
// event: room-join-req
{
"userId": "id of user joining",
"roomId": "id of room to join",
"roomPw": "password of room"
}
// event: room-join-resp
{
"response": {
"success": "false",
"error": {
"code": "3",
"message": "Requested room to join is full"
}
},
"userId": "id of user joined",
"roomId": "id of room joined"
"users": ["userId1", "userId2", "userId3"] // User Server에서 받아야 할 듯
}
// room-join-notify
{
"userId": "id of user joined"
}
방 목록 보기
// event: rooms-list-req
{
"gameId": "id of game to play",
"page": "3"
}
// event: rooms-list-resp
{
"response": {
"success": "false",
"error": {
"code": "5",
"message": "Unknown error"
},
"rooms": [
{
"roomId": "id of room",
"roomName": "name of room created",
"host": "id of user created room"
"isLocked": "false",
"roomPw": "password of room created",
"gameId": "id of game to play",
"headcount": "1",
"roomSize": {
"min": "min number of players",
"max": "max number of players"
},
{
"roomId": "id of room",
"roomName": "name of room created",
"host": "id of user created room"
"isLocked": "false",
"roomPw": "password of room created",
"gameId": "id of game to play",
"headcount": "1",
"roomSize": {
"min": "min number of players",
"max": "max number of players"
}
]
}
방 나가기
// event: room-exit-req
{
"userId": "id of user exiting",
"roomId": "id of room to exit"
}
// event: room-exit-resp
{
"response": {
"success": "false",
"error": {
"code": "6",
"message": "Already exited"
},
"userId": "id of user exited",
"roomId": "id of room exited",
}
// event: room-exit-notify
{
"userId": "id of user"
}