-
Notifications
You must be signed in to change notification settings - Fork 2
API Docs ‐ GroupOrder
-
MENUADD: 메뉴 수량 증가 -
MENUSUB: 메뉴 수량 감소 -
STARTORDER: 주문 시작 -
UNSUB: 구독 취소 요청
-
INIT: 초기 정보 -
MENUUPDATE: 메뉴 수량 변경 -
MEMBERUPDATE: 참여자 수 변경 -
UNSUB: 구독 취소 확인 -
STARTORDER: 주문 시작 알림 -
TIMEUPDATE: 세션 시간 업데이트 -
PRESESSIONEND: 세션 종료 1분 전 -
SESSIONEND: 세션 종료 -
ERROR: 오류 메시지
- 웹소켓 연결:
ws://server-url/ws
모든 메시지는 JSON 형식을 사용
{
"type": "메시지 타입",
"boothId": "UUID boothId",
"tableNum": "테이블 번호",
"payload": {"메시지 타입에 따른 데이터 구분"}
}
사용자가 QR코드를 스캔하여 주문 페이지에 접속할 때
STOMP 명령: SUBSCRIBE
header :
destination: /topic/{boothId}/{tableNum}
message: None
STOMP 명령: MESSAGE
header:
destination: /user/{sessionId}/topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "INIT",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"memberCount": "Integer",
"totalPrice": "Integer",
"totalCount": "Integer",
"remainingMinutes" : "Integer",
"menuList": [
{
"menuId": "UUID-1",
"menuCount": "Integer"
},
{
"menuId": "UUID-2",
"menuCount": "Integer"
}
]
}
}
STOMP 명령: MESSAGE
header:
destination: /topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "MEMBERUPDATE",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"memberCount": "Integer"
}
}
사용자가 메뉴 수량 증가(+) 버튼을 클릭할 때 발생
STOMP 명령: SEND
header :
destination: /app/order
content-type: application/json
message :
{
"type": "MENUADD",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"menuId": "UUID-1"
"menuCount": "Integer",
"totalPrice": "Integer",
"totalCount": "Integer"
}
}
STOMP 명령: MESSAGE
header :
destination: /topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "MENUUPDATE",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"menuId": "UUID-1",
"menuCount": "Integer",
"totalPrice": "Integer",
"totalCount": "Integer"
}
}
사용자가 메뉴 수량 감소(-) 버튼을 클릭할 때 발생
STOMP 명령: SEND
header :
destination: /app/order
content-type: application/json
message :
{
"type": "MENUSUB",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"menuId": "UUID-1",
"menuCount": "Integer",
"totalPrice": "Integer",
"totalCount": "Integer"
}
}
STOMP 명령: MESSAGE
header :
destination: /topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "MENUUPDATE",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"menuId": "UUID-1",
"menuCount": "Integer",
"totalPrice": "Integer",
"totalCount": "Integer"
}
}
사용자가 주문하기 버튼을 클릭할 때 발생
STOMP 명령: SEND
header :
destination: /app/order
content-type: application/json
message :
{
"type": "STARTORDER",
"boothId": "UUID",
"tableNum": "Integer"
}
STOMP 명령: MESSAGE
header :
destination: /topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "STARTORDER",
"boothId": "UUID",
"tableNum": "Integer"
}
사용자가 주문 페이지를 나가거나, 취소 버튼을 클릭할 때 발생
STOMP 명령: SEND
header:
destination: /app/order
content-type: application/json
message :
{
"type": "UNSUB",
"boothId": "UUID",
"tableNum": "Integer"
}
STOMP 명령: MESSAGE
header :
destination: /user/{sessionId}/topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "UNSUB",
"boothId": "UUID",
"tableNum": "Integer"
}
STOMP 명령: MESSAGE
헤더:
destination: /topic/{boothId}/{tableNum}
content-type: application/json
본문:
{
"type": "MEMBERUPDATE",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"memberCount": "Integer"
}
}
서버에서 1분마다 세션 남은 시간을 클라이언트에게 전송
STOMP 명령: MESSAGE
header :
destination: /topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "TIMEUPDATE",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"remainingMinutes": "Integer"
}
}
세션 종료 1분 전에 서버에서 클라이언트에게 알림
STOMP 명령: MESSAGE
header :
destination: /topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "PRESESSIONEND",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"remainingMinutes": 1
}
}
세션 제한 시간 10분이 지나면 서버에서 세션을 종료하고 클라이언트에게 알림
STOMP 명령: MESSAGE
header :
destination: /topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "SESSIONEND",
"boothId": "UUID",
"tableNum": "Integer",
"payload": {
"remainingMinutes": 0
}
}
서버에서 오류가 발생한 경우 클라이언트에게 알림
STOMP 명령: MESSAGE
header :
destination: /topic/{boothId}/{tableNum}
content-type: application/json
message :
{
"type": "ERROR",
"boothId": "UUID",
"tableNum": "Integer",
"payload": "요청 처리 중 오류 발생: [오류 메시지]"
}