웹소켓 (WebSockets)
단일 TCP 연결을 통해 전이중(full-duplex) 통신 채널을 제공하는 통신 프로토콜.
전통적인 HTTP의 단점인 단방향성을 극복하여, 서버가 클라이언트에 데이터를 적극적으로 '푸시'할 수 있게 해줍니다.
graph LR
Center["웹소켓 (WebSockets)"]:::main
Rel_websocket["websocket"]:::related -.-> Center
click Rel_websocket "/terms/websocket"
Rel_http["http"]:::related -.-> Center
click Rel_http "/terms/http"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧒 5살도 이해할 수 있게 설명
계속 연결되어 있는 전화기와 같습니다. 한쪽에서 말하면 반대쪽에서도 즉시 들을 수 있고, 서로 동시에 말할 수도 있습니다.
🤓 Expert Deep Dive
RFC 6455에 정의된 사양으로, HTTP 핸드셰이크를 통해 업그레이드됩니다. 주식 주문창, 실시간 알림, 멀티플레이어 게임 등에 사용됩니다. 낮은 지연시간이 강점입니다.
❓ 자주 묻는 질문
Is WebSocket better than HTTP?
For real-time data, yes. For static content or standard web pages, HTTP is more efficient.
Does WebSocket use a port?
It typically uses port 80 for WS and 443 for WSS, shares with HTTP.