그 전에 HTTP 통신부터 설명하자
✔ client -> request -> server -> response -> client
채팅기능을 사용하려고 할 때, 채팅 메세지를 계속해서 request 해서 받아 올 수 없기 때문에 open - close의 양방향 통신을 함
STOMP is the Simple (or Streaming) Text Orientated Messaging Protocol.
STOMP provides an interoperable wire format so that STOMP clients can communicate with any STOMP message broker to provide easy and widespread messaging interoperability among many languages, platforms and brokers.
출처 : https://stomp.github.io/
Web Socket 위에서 동작하는 Protocol 로써 클라이언트와 서버가 전달할 메세지의 유형, 형식, 내용등을 정의 하는 매커니즘
여기서 우리는
채팅방 생성 : pub/sub 구현을 위한 TOPIC 생성
채팅방 입장 : TOPIC 구독
메세지 송수신 : 해당 TOPIC으로 메세지를 송신(pub), 수신(sub)
spring은 메세지를 외부 Broker에게 전달하고,
Broker는 Web Socket으로 연결된 클라이언트에게 메세지를 전달하는 구조
출처 : https://dev-gorany.tistory.com/235?category=901854