What protocol should we use for which use case?
Before we jump into the different use cases and which protocol to use, let’s understand the differences between the different protocols and compare them along the following dimensions:
Feature |
HTTP |
SSE |
WebSockets |
Communication model |
Request-response |
Unidirectional (server to client) |
Bidirectional |
Connection type |
Short-lived |
Long-lived |
Long-lived |
Data format |
Text (HTML, JSON, etc.) |
Text (event-stream) |
Text and binary |
Use case examples |
Web pages, REST APIs ... |