์น์์ผ/STOMP ์ฑํ ์๋น์ค(spring, vue, redis)
์น์์ผ/stomp, springboot๋ฅผํ์ฉํ์ฌ ์ฑํ ์๋น์ค๋ฅผ ๊ฐ๋ฐํฉ๋๋ค. ๋น๊ต์ ์ฌ์ด ํ๋ ์์ํฌ์ธ vue.js๋ฅผ ํตํด ๊ฐ๋จํ ํ๋ฉด๋ ํจ๊ป ๊ตฌ์ฑํฉ๋๋ค. redis pub/sub์ ํตํด ๋ค์ค์๋ฒ ํ์ฅ์ฑ ์ค๊ณ๊น์ง ๊ตฌ์ฑํฉ๋๋ค.
์๊ฐ์ 518๋ช
๋์ด๋ ์ด๊ธ
์๊ฐ๊ธฐํ ๋ฌด์ ํ

- ๋ฏธํด๊ฒฐ
ERD ์ง๋ฌธ
์๋ ํ์ธ์ ~ ๊ฐ์ ์ ์๊ฐํ๊ณ ์์ต๋๋ค !ERD ๋ถ๋ถ์์ ์ง๋ฌธ์ด ์๊ฒจ ์ฌ์ญค๋ณด๊ฒ ๋์์ต๋๋ค !!<p style="text-align: lef
spring-bootwebsocketstomp-websocketpubsubvue-3wonderwall09in
ใป
2๋ฌ ์
0
54
2
- ๋ฏธํด๊ฒฐ
StompHandler ๊ดํ ์ง๋ฌธ
์๋ ํ์ธ์ ๊ฐ์๋ฅผ ํ ๋๋ก ํ๋ก์ ํธ์ ์ฑํ ๊ธฐ๋ฅ์ ๊ตฌํ์ค์ ๋๋ค.๊ฐ์์์๋ StompHandler ์์ CONNECT, SUBSCRIBE ์ธ ๊ฒฝ์ฐ๋ง ๋ค๋ฃจ๋๋ฐ ์ ๋ SEND ์ธ ๊ฒฝ์ฐ์ ์ฝ๋๋ ์์ฑ์ค์ ๋๋ค.SEND
spring-bootwebsocketstomp-websocketcanach3
ใป
6๋ฌ ์
0
80
2
- ๋ฏธํด๊ฒฐ
์ค์๊ฐ ์๋น์ค ๊ด๋ จ ์ง๋ฌธ
์์ง ์๊ฐ์ ํ์ง ์์ ์ง๋ฌธ๋๋ฆฝ๋๋ค. ์ค์๊ฐ ์๋น์ค์์ MYSQL๊ณผ ๊ฐ์ RDBMS๋ก ๋ฉ์ธ์ง ์ฝ
ํจ์
ใป
6๋ฌ ์
0
66
2
- ๋ฏธํด๊ฒฐ
๋ฆฌํ๋ ์ ํ ํฐ์ ์์์ ๊ตฌํํ๋ฉด ๋๋๊ฑด๊ฐ์??
๋ฆฌํ๋ ์ ํ ํฐ์ ์์์ ๊ตฌํํด์ผ ํ๋ฉด ๋๋๊ฑด๊ฐ์?? ๋ฐ๋ก ์๋๋ฐ..
spring-bootwebsocketstomp-websocketpubsubvue-3jea_hyuk
ใป
7๋ฌ ์
0
79
2
- ๋ฏธํด๊ฒฐ
cors, csrf ์ง์ ๊ตฌํ
์๋ ํ์ธ์. ๊ฐ์ ์ ๋ฃ๊ณ ์์ต๋๋ค. ๋ฌ๊ธ์๋ ์ง๋ฌธํ๋ ๋๋ ค๋ ๋ ๊น์? ์คํ๋ง ์ํ๋ฆฌํฐ ์์ด cors ๊ตฌํ, csrf ์ฐจ๋จ ๊ธฐ๋ฅ ๋ง๋๋๊ฒ ์ข
spring-boot๊น์ฐํ ๋ฉ๋ก
ใป
7๋ฌ ์
0
65
1
- ๋ฏธํด๊ฒฐ
JWT ํํฐ๊ตฌํ
์๋ ํ์ธ์ Jwtํํฐ๋ฅผ GenericFilterBean ๋์ OncePerRequestFilter๋ฅผ ์์ ๋ฐ๊ณ </
spring-bootSunJ
ใป
7๋ฌ ์
0
98
2
- ๋ฏธํด๊ฒฐ
๊ฐ์ ์๋ฃ๊ณ ์์ต๋๋ค. ํน์ ๋ค์ ๊ฐ์ ๊ณํ์ ์์ผ์ ๊ฐ์?
๊ฐ์ ์๋ฃ๊ณ ์์ต๋๋ค. ํน์ ๋ค์ ๊ฐ์ ๊ณํ์ ์์ผ์ ๊ฐ์?
spring-bootwebsocketstomp-websocketpubsubvue-3eokhwa333
ใป
7๋ฌ ์
0
57
1
- ๋ฏธํด๊ฒฐ
STOMP ๋์ ๊ณผ์ ์ง๋ฌธ
๊ฐ์์์ STOMP ๋์ ๊ฐ /app, /topic ์์ฒญ์ ๋์์ ๋ณด๋ธ๋ค๊ณ ํ์ จ๋๋ฐ ๊ทธ๋ผ app ๊ฒฝ๋ก ๋ฐํ๋ ๋ฉ์ธ์ง๋ broker๋ฅผ ํตํด์ topic ๊ฒฝ๋ก๋ก ์ ๋ฌ์ด ๋๊ณ ๋งจ ์ฒ์์ ๋์์ ๋ณด๋ธ topic ์์ฒญ๋ brok
spring-bootwebsocketstomp-websocketpubsubvue-3๋ ๋์ด
ใป
7๋ฌ ์
0
48
1
- ๋ฏธํด๊ฒฐ
chain.doFilter()
JwtAuthFilter์์ ํ ํฐ์ด ์์ ๋ ์์ธ๋ฅผ ๋์ง์ง ์๊ณ ๊ทธ๋ฅ chain.doFilter()๋ฅผ ํธ์ถํ๋ ์ด์ ๋?
spring-bootwebsocketstomp-websocketpubsubvue-3์ต๋ช ๋ฆฌ
ใป
7๋ฌ ์
0
45
1
- ๋ฏธํด๊ฒฐ
์๋ฐ 21๋ก ์์ค ์์ฑํด๋ ๋๋์?
์๋ฐ 17๋ก ๋์ด ์๋๋ฐ ์๋ฐ 21๋ก ์์ค ์์ฑํด๋ ๋๋์?
spring-bootwebsocketstomp-websocketpubsubvue-3dongk
ใป
7๋ฌ ์
0
60
2
- ๋ฏธํด๊ฒฐ
๋ฉ์์ง ๋ธ๋ก์ปค ์ ํ์ ๊ดํ ์ง๋ฌธ
์๋ ํ์ธ์, ๊ฐ์์์๋ ๋ฉ์์ง ๋ธ๋ก์ปค์ฉ์ผ๋ก redis๋ฅผ ์ฌ์ฉํ์ จ๋๋ฐ, redis ์ธ์๋ rabbitmq๋ ์นดํ์นด ๊ฐ์ ๊ฒ๋ค๋ ์ฌ์ฉ๋๋ ๊ฒ์ผ๋ก ์๊ณ ์์ต๋๋ค. ๊ทธ ์ค์์ ํน๋ณํ redis๋ฅผ ์ฌ์ฉํ ์ด์ ๊ฐ ์๋
spring-bootwebsocketstomp-websocketpubsubvue-3yso829612
ใป
7๋ฌ ์
0
65
2
- ๋ฏธํด๊ฒฐ
WebSocket๊ณผ Spring Security ์ง๋ฌธ
WebSocket ์ฐ๊ฒฐ์ด ์ฒ์ http์์ฒญ์ผ๋ก ์์ํ๊ธฐ ๋๋ฌธ์ ํํฐ ์ฒด์ธ์ด ์์ฒญ์ ๊ฐ๋ก์ฑ๋ค.๋ฐ๋ผ์ /connect๋ฅผ permitAll()๋ก ํ์ด์ค์ผ 400์๋ฌ๊ฐ
spring-bootwebsocketstomp-websocketpubsubvue-3ํจ์
ใป
7๋ฌ ์
0
81
2
- ๋ฏธํด๊ฒฐ
์ถ๊ฐ ์ปค์คํ ๊ตฌํ ์ง๋ฌธ ์์ต๋๋ค.
๋ก๊ทธ์ธ์ ํ์ ๋ ์์๋ ์ฑํ ๋ฐฉ์ ์ ์ฝ์ ๋ฉ์์ง๊ฐ ์๋ค๋ฉด, ์๋ฆผ(๋ณดํต ์ข ๋ชจ์)์ +์์ฝ์๋ฉ์์ง์ซ์๋ฅผ ๊ตฌํ ํ๋ ค๊ณ ํ ๋ sse ํต์ ์ ์ด์ฉํ๋๊ฒ ์ข์๊น์?
spring-bootwebsocketstomp-websocketpubsubvue-3ํ ๋
ใป
7๋ฌ ์
0
61
2
- ๋ฏธํด๊ฒฐ
connect์ ๋์์ ๊ตฌ๋ ํ๋๋ฐ ๊ตฌ๋ ๊ฒ์ฆ์ด ๊ผญ ํ์ํ๊ฐ์?
์ฐ์ ์ต์ด ์น ์์ผ ์ฐ๊ฒฐ์ ํ ํฐ ๊ฒ์ฆ์ ์งํํ๊ณ , ์ฐ๊ฒฐ์ ์ฑ๊ณตํ๋ฉด ํน์ ํ ํฝ์ ๋ฐ๋ก ๊ตฌ๋ ํ๋ ๊ฑธ๋ก ์ ๊ณ ์์ต๋๋ค.์ด ๋ ์์ ์ด ๊ฑฐ์ ๋์์ ์ด๋ฃจ์ด์ง๋ค๊ณ ๋ณด๋๋ฐ,
spring-bootwebsocketstomp-websocketpubsubvue-3ํธ๋ฆด
ใป
8๋ฌ ์
0
97
2
- ๋ฏธํด๊ฒฐ
์ ๋ ๋์ผํ ์ง๋ฌธ์ธ๋ฐ
์ ๋์ปค Redis cli ํฐ๋ฏธ๋ ๋ด์์ ๊ฐ์ฌ๋์ด ๋ง์ํด์ฃผ์ ๊ฑฐ์ฒ๋ผ ํด๋ ๋ฉ์์ง๊ฐ ์ ์ค๊ณ PUBSUB CHANNELS Empty List๋ผ๊ณ ๋ฐ๊น์ ๊ทผ๋ฐ ๊ฐ์ฌ๋์ฒ๋ผ 8080 8081 ์๋ฒ๊ฐ์ ํต์ ์ ๋ผ์ ๋ฌธ์ ๊ฐ ๋ฌด์์ธ
spring-bootwebsocketstomp-websocketpubsubvue-3์์ฑ์ ์์
ใป
8๋ฌ ์
0
78
3
- ๋ฏธํด๊ฒฐ
token์ด ํ์ํ ์๋ํฌ์ธํธ์ ์๋์ ์ผ๋ก ํ ํฐ ๋๋ฝ์ ๋์ฒ
์๋์ ์ผ๋ก ํ ํฐ์ ๋๋ฝํ๋ฉด 403 ํฌ๋น๋ ์ด ๋ฐ์ํ๋๋ฐ, ์ด๋ ๋ง์ํ์ ๋ฐ๋ก filterConfig์์ ์๋ฌ๋ฅผ ์ก๋๋ค๊ณ ํ๋ฉด,ํด๋น ์๋ฌ ์ฝ๋์ ๋ด์ฉ์ ์ปค์คํ ํ๋ ค๋ฉด
spring-bootwebsocketstomp-websocketpubsubvue-3ํธ๋ฆด
ใป
8๋ฌ ์
0
67
2
- ๋ฏธํด๊ฒฐ
์์ ์๋ฃ๊ฐ ์ ๋ค ๋๋ ์ ธ์๋์?
๊ฐ์๋ง๋ค ๋ชจ๋ ์์ ์๋ฃ๋ฅผ ๋ค ๋ค์ด๋ฐ์์ผํ๋์?;;
spring-bootwebsocketstomp-websocketpubsubvue-3ํธ๋ฆด
ใป
8๋ฌ ์
0
78
2
- ํด๊ฒฐ
๋ฉ์์ง ์ ์ก ์ ๊ฒ์ฆ
StompCommand.SEND ๋ ์๊ธธ๋ ๊ถ๊ธํด์ ์ง๋ฌธ ๋จ๊น๋๋ค! ๋ฉ์์ง ์ ์ก ์ subscribeํ ๋์ ๊ฐ์ ๊ฒ์ฆ์ ํ ํ์๋ ์์๊น์?"์ฑํ ๋ฐฉ์ ์ฐธ์ฌ์์ฌ์ผ
spring-bootwebsocketstomp-websocketpubsubvue-3์ด๋ฐ๊ฐ๋ฐ
ใป
8๋ฌ ์
0
61
2
- ๋ฏธํด๊ฒฐ
JWT ์์ฑ ์ subject ์ค์ ์ ๋ํ ์ง๋ฌธ
์๋ ํ์ธ์.JWT๋ฅผ ์์ฑํ๋ ์ฝ๋(JwtTokenProvider.java์ createToken)์์๋ Claims ๊ฐ์ฒด๋ฅผ ๋จผ์ ์์ฑํ๊ณ claims.
spring-bootwebsocketstomp-websocketpubsubvue-3์ด๊ฐ์
ใป
8๋ฌ ์
0
158
3
- ํด๊ฒฐ
StompHandler ์ง๋ฌธ ์์ต๋๋ค.
ํ์ฌ ์ธํฐ์ ํฐ์์๋ ํ ํฐ์ ๊ฒ์ฆ๋ง ํ๊ณ ์๋๋ฐ, "ํ ํฐ ๊ฒ์ฆ ํ์ ์ธ์ฆ ๊ฐ์ฒด๋ฅผ SecurityContextHolder์ ์ ์ฅํด์ผ ํ์ง ์๋?" ๋ผ๋ ์๊ฐ์ด ๋ค์์ต๋๋ค. ์ด ๋ถ๋ถ์ ๊ฐ์์์
spring-bootwebsocketstomp-websocketpubsubvue-3์ด๋ฐ๊ฐ๋ฐ
ใป
8๋ฌ ์
0
82
2






