Protocols
Saved & recent

HTTP vs WebSocket

HTTPWebSocket
DefinitionA 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 modelA 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 semanticsStandard 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 useConnections can be reused; a request does not inherently require a fresh connection.An opening handshake establishes the channel for subsequent messages.
A useful starting pointResource 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.
Further reading

View in the full Protocols collection