Continuous data rather than requests.
WHAT THEY PROVIDE
Data delivered as it becomes available.
WHERE THAT SUITS
Live prices and metrics Progressive responses from slow operations Activity feeds Long-running results
WHAT THE MECHANISMS ARE
A response sent in pieces Server-sent events A persistent two-way connection
WHAT CHUNKED RESPONSES PROVIDE
Starting to deliver before the whole result exists.
WHERE THAT MATTERS
Large exports, and model responses.
WHAT SERVER-SENT EVENTS PROVIDE
A simple one-way stream with automatic reconnection.
WHAT PERSISTENT CONNECTIONS ADD
Two-way communication.
WHAT THEY COST
Connection state, and complexity when scaling.
WHY SCALING IS HARDER
Connections are long-lived, so load cannot be redistributed by request.
WHAT CLIENTS MUST HANDLE
Reconnection Resuming from where they stopped Duplicates after reconnection
WHAT TO PROVIDE FOR RESUMPTION
A position identifier the client sends when reconnecting.
WHY THAT MATTERS ESPECIALLY LOCALLY
Connections drop, and without resumption the client misses everything in the gap.
WHAT TO SEND PERIODICALLY
A keep-alive, so intermediaries do not close the connection.
WHAT TO TEST
Behaviour on a deliberately unstable connection.