| HTTP | WebSocket |
|---|
| Definition | A family of application-level request/response protocols with shared methods, status codes, and representation semantics. | An application protocol for two-way messages over an established connection. RFC 6455 defines an opening handshake followed by message framing. |
|---|
| Message model | A client sends a request and a server returns a response. A response body can stream. | After establishment, either endpoint can send messages without a new HTTP request for each message. |
|---|
| Built-in semantics | Standard methods, status codes, headers, and rules for representations and caching. | Text/binary message framing and control frames; application message meanings are defined by the application. |
|---|
| Connection use | Connections can be reused; a request does not inherently require a fresh connection. | An opening handshake establishes the channel for subsequent messages. |
|---|
| A useful starting point | Resource retrieval and APIs that benefit from standard request/response semantics. | Ongoing two-way exchanges such as collaborative updates; the application still needs to define reconnection and message handling. |
|---|
View in the full Protocols collection