HTTP보다 웹소켓 프로토콜이 가벼운 이유
[ Application Layer ] ────────── HTTP, WebSocket
[ Transport Layer ] ────────── TCP
[ Network Layer ] ────────── IP✅ 2. WebSocket vs HTTP: 차이점
항목
HTTP
WebSocket
📌 HTTP
POST /chat HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 Accept: */* Content-Type: application/json Content-Length: 42 Authorization: Bearer xxxxxx Cookie: session_id=abcd1234 {"message": "Hello, this is a message"}
📌 WebSocket
📦 메시지 1개 전송 (텍스트 “hi”)
📤 클라이언트 또는 서버가 먼저 전송:
✅ 2. 종료 순서
✅ 실제 사용 예
✅ 클라이언트 정상 종료:
✅ 서버 종료 (Spring 등):
웹은 대부분 “요청-응답” 모델이 적합
Last updated