실시간 채팅
-
실시간 채팅 구현개발공부/React 2024. 1. 24. 21:10
본 글은 React에서 Websocket & STOMP 를 사용해 실시간 채팅을 구현한 내용입니다. Websocket, STOMP 모두 프로토콜이다. (자세히 알고 싶다면 링크를 타고 들어가서 확인해보면 될 거 같다.) 두 가지 프로토콜이 어떤 특징을 가지고 있어서 실시간 채팅을 구현할 수 있는지 간단하게 정리해봤다. Websocket 양방향 통신을 지원하며, 지속적인 연결을 통해 실시간 데이터 전송을 가능하게 해줌 STOMP 메시지 기반의 프로토콜로 쉬운 구현과 클라이언트-서버 간의 효과적인 양방향 통신을 제공 실시간 채팅 구현 두 프로토콜의 특징을 알아봤으니 이제 실제로 활용해서 기능을 구현해보려고 한다. 먼저 단계를 설명하자면 아래와 같다. SockJS 객체를 생성합니다. (웹소켁 연결을 위한 객체..