WebSocket
- 사용자의 브라우저와 서버 사이이 인터렉티브 통신 세션을 설정할 수 있게 하는 고급 기술이다.
- 개발자는 웹 소켓 API를 통해 서버로 메시지를 보내고 서버의 응답을 위해 서버를 폴링하지 않고도 이벤트 중심 응답을 받는 것이 가능합니다.
- Socket Over HTTP (ws://...or wss://...) -> http상에 존재함(http 기반이다)
- IE10+ (Can use pure WebSocket javascript library)
SockJS
- Like socket.io( NodeJS) Polyfill
- IE 8+ (Use sockjs-client library)
-
STOMP(Streaming Text Oriented Messaging Protocol) : 토픽 구독방식
- Spring Only, Publish(topic/queue) & Subscribe
- Sub Protocol Over SockJS ->Custom Format for Message (SockJS랑 같이 쓴다)
- Use stomp js library
- json format 사용
Configuration(@EnableWebSocketMessageBroker)
- endpoint with SockJS
- message broker
Controller(메시지 수신 및 전환)
@MessageMapping("/TTT")
@SendTo("/topic/message")
public String tttMessage(String message)
'java > spring' 카테고리의 다른 글
ResponseDto 사용이유 (0) | 2022.12.05 |
---|---|
Spring Security 작동 순서 (0) | 2022.10.13 |
스프링 부트 동작 원리 (0) | 2022.10.09 |
Spring IoC (0) | 2022.10.09 |
DI(Dependency Injection) (0) | 2022.10.09 |
댓글