-
게임방 생성
# 명령프롬프트
curl -X POST -H "Content-Type: application/json" -d "name=한판하자" http://localhost:8070/room
# return 1 (1씩 증가하는 값)
-
홍길동(senderId = 1) 게임방입장
- 소켓연결 : ws://localhost:8070/ws-stomp
- 구독 : /sub/room/1
- DESTINATION PATH : /pub/room/enter
- message(JSON) : { "roomId":1, "senderId":1 }
- => 응답 : {"command":"WAITING","gameId":null,"receiverId":null,"ballCount":null}
-
이순신(senderId = 1) 게임방입장 (브라우저 새창)
- 소켓연결 : ws://localhost:8070/ws-stomp
- 구독 : /sub/room/1
- DESTINATION PATH : /pub/room/enter
- message(JSON) : { "roomId":1, "senderId":2 }
- => 응답 : {"command":"SET_HIDDEN","gameId":1,"receiverId":null,"ballCount":null}
-
홍길동(senderId = 1) 히든숫자 설정
# 명령프롬프트
curl -X POST -H "Content-Type: application/json" -d "{\"senderId\":1,\"hiddenNumber\":135}" http://localhost:8070/game/1/ready
# return {"boardId": 1, "ready": false }
-
이순신(senderId = 2) 히든숫자 설정
# 명령프롬프트
curl -X POST -H "Content-Type: application/json" -d "{\"senderId\":2,\"hiddenNumber\":975}" http://localhost:8070/game/1/ready
# return {"boardId": 2, "ready": true }
-
이순신(senderId = 2) 게임시작 호출(ready:true를 받은 쪽에서 호출한다.)
- DESTINATION PATH : /pub/game/start
- message(JSON) : { "roomId":1, "gameId":1, "senderId":2 }
- => 응답 : {"command":"GAME_START","gameId":1,"receiverId":1,"ballCount":null}
-
홍길동(senderId = 1) 피칭 시작 (홈팀)
- DESTINATION PATH : /pub/game/pitching
- message(JSON) : {"roomId":1, "gameId":1, "boardId": 1, "senderId":1, "pitching": "123"}
- => 응답 : {"command":"BALL_COUNT","gameId":1,"receiverId":2,"ballCount":{"pitching":"123","strike":1,"ball":1,"pitchClock":0}}
-
이순신(senderId = 2) 피칭 (원정팀)
- DESTINATION PATH : /pub/game/pitching
- message(JSON) : {"roomId":1, "gameId":1, "boardId": 2, "senderId":2, "pitching": "789"}
- => 응답 : {"command":"BALL_COUNT","gameId":1,"receiverId":1,"ballCount":{"pitching":"789","strike":0,"ball":0,"pitchClock":0}}