Skip to content

Commit 3d27086

Browse files
committed
docs: WebSocket STOMP 채팅 프로토콜 Swagger 문서 추가
1 parent 3cd31ff commit 3d27086

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package com.back.web7_9_codecrete_be.domain.chats.controller;
2+
3+
import org.springframework.web.bind.annotation.GetMapping;
4+
import org.springframework.web.bind.annotation.RequestMapping;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
import com.back.web7_9_codecrete_be.domain.chats.dto.ChatMessageRequest;
8+
import com.back.web7_9_codecrete_be.domain.chats.dto.ChatMessageResponse;
9+
10+
import io.swagger.v3.oas.annotations.Operation;
11+
import io.swagger.v3.oas.annotations.media.Content;
12+
import io.swagger.v3.oas.annotations.media.Schema;
13+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
14+
import io.swagger.v3.oas.annotations.tags.Tag;
15+
16+
@RestController
17+
@RequestMapping("/docs/chat")
18+
@Tag(name = "Chat STOMP", description = "WebSocket / STOMP 채팅 프로토콜 문서. 문서용 API. 사용X")
19+
public class ChatStompDocsController {
20+
21+
@Operation(
22+
summary = "채팅 메시지 전송 (STOMP)",
23+
description = """
24+
### 📡 WebSocket STOMP 채팅 메시지 전송
25+
26+
#### 1️⃣ WebSocket Endpoint
27+
```
28+
ws://localhost:8080/ws-chat
29+
or
30+
wss://www.naeconcertbutakhae.shop/ws-chat
31+
```
32+
33+
#### 2️⃣ SEND Destination
34+
```
35+
/app/chat/send
36+
```
37+
38+
#### 3️⃣ SUBSCRIBE Destination
39+
```
40+
/topic/chat/{concertId}
41+
```
42+
43+
#### 4️⃣ SEND Payload
44+
```json
45+
{
46+
"concertId": 1,
47+
"content": "안녕하세요!"
48+
}
49+
```
50+
51+
#### 5️⃣ SUBSCRIBE Response
52+
```json
53+
{
54+
"concertId": 1,
55+
"senderId": 10,
56+
"senderName": "테스트 유저",
57+
"content": "안녕하세요!",
58+
"sentAt": "2025-12-23T15:30:00"
59+
}
60+
```
61+
"""
62+
)
63+
@GetMapping("/stomp")
64+
public void stompChatGuide() {}
65+
66+
@Operation(
67+
summary = "STOMP 채팅 메시지 전송 규격",
68+
description = """
69+
WebSocket + STOMP 기반 채팅 메시지 전송 규격입니다.
70+
71+
- 실제 사용되는 HTTP API 아닙니다.
72+
- Swagger 문서용
73+
""",
74+
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
75+
description = "STOMP 메세지 SEND하면 전달되는 요청 데이터",
76+
required = true,
77+
content = @Content(
78+
schema = @Schema(implementation = ChatMessageRequest.class)
79+
)
80+
),
81+
responses = {
82+
@ApiResponse(
83+
responseCode = "200",
84+
description = "STOMP SUBSCRIBE로 수신되는 메시지",
85+
content = @Content(
86+
schema = @Schema(implementation = ChatMessageResponse.class)
87+
)
88+
)
89+
}
90+
)
91+
@GetMapping("/message-schema")
92+
public ChatMessageResponse messageSchema() {
93+
return null; // 실제 반환 목적 X
94+
}
95+
}
96+

0 commit comments

Comments
 (0)