PUSH Technologies - An Overview: Difference between revisions

From PiRho Knowledgebase
Jump to navigationJump to search
Dex (talk | contribs)
Dex (talk | contribs)
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:PUSH Technologies: An Overview}}
'''PUSH technologies''' allow servers to deliver updates to clients the moment something meaningful happens.
{{ShortDescription|A clear, practical comparison of real-time PUSH technologies across six major mechanisms.}}
Unlike traditional request/response patterns, PUSH reverses the flow: the server becomes the initiator.
{{Infobox PublicTech
| title        = PUSH Technologies: An Overview
| expertise    = Systems Architecture • Web Engineering • Real-Time Communication
| area        = [[Category:Architecture]] [[Category:Standards]] [[Category:Real-Time Systems]]
| updated      = 2026-02-05
}}


'''PUSH technologies''' allow servers to deliver updates to clients instantly when data changes, without requiring repeated polling. This article compares the six major PUSH mechanisms—Server-Sent Events, WebSockets, MQTT, Long‑Polling, Web Push API, and the Web Push Protocol (RFC 8030)—explaining how each works, where they fit, and how to choose between them.
This article provides a clear architectural overview of the major PUSH mechanisms, how they behave, where they fit, and how to choose between them. Deep‑dive technical articles for each protocol are linked throughout.


== What “PUSH” Means ==
== Why PUSH Matters ==
PUSH reverses the traditional HTTP request/response flow by enabling servers to send updates the moment something meaningful happens.
 
This requires:
Modern systems increasingly expect events to arrive instantly. Users no longer tolerate:
* a persistent or semi‑persistent channel
* polling delays 
* a subscription mechanism
* stale dashboards 
* a delivery engine
* race conditions between systems 
* event triggers
* manual refresh cycles 
 
PUSH solves these challenges by establishing:
* a persistent or semi‑persistent communication channel
* a subscription or routing mechanism
* an event‑triggered delivery engine
 
PUSH enables:
* real‑time dashboards 
* collaborative experiences 
* workflow updates 
* IoT telemetry 
* notification ecosystems 
* cross‑system synchronisation 
 
== The Major PUSH Technologies ==
 
This overview covers the six primary PUSH families used across web, mobile, and IoT systems:
 
* '''Server‑Sent Events (SSE)''' — one‑way server → client streaming 
* '''WebSockets''' — full‑duplex, bidirectional communication 
* '''MQTT v5''' — IoT‑focused publish/subscribe messaging 
* '''Long‑Polling''' — legacy, simulated PUSH using held HTTP requests 
* '''Web Push API''' — browser notifications delivered via Service Workers 
* '''Web Push Protocol (RFC 8030)''' — server → push service → browser channel
 
Each solves a different architectural problem. None replaces the others.


== Summary Comparison Table ==
== Summary Comparison Table ==
{| class="wikitable"
{| class="wikitable"
! Technology !! Directionality !! Ideal Use Cases !! Complexity
! Technology !! Directionality !! Ideal Use Cases !! Complexity
|-
|-
| SSE || Server→Client || Notifications, dashboards, workflow updates || Low
| '''SSE''' || Server → Client || Notifications, dashboards, workflow events || Low
|-
|-
| WebSockets || Full‑duplex || Chat, collaboration, presence || Medium–High
| '''WebSockets''' || Full‑duplex || Chat, collaboration, presence, shared editing || Medium–High
|-
|-
| MQTT || Pub/Sub || IoT, sensors, distributed systems || Medium
| '''MQTT v5''' || Publish/Subscribe || IoT, telemetry, distributed systems || Medium
|-
|-
| Long‑polling || Simulated PUSH || Legacy fallback || Low
| '''Long‑Polling''' || Simulated PUSH || Legacy fallback, older browsers/servers || Low
|-
|-
| Web Push API || Server→Browser (via Service Worker) || User notifications, app background updates || Medium
| '''Web Push API''' || Server → Browser (via SW) || Notifications when app is closed || Medium
|-
|-
| Web Push Protocol (RFC 8030) || Server→Push Service→Browser || Reliable delivery, offline notifications || Medium
| '''Web Push Protocol''' (RFC 8030) || Server → Push Service → Browser || Reliable background delivery || Medium
|}
|}


== Major PUSH Technologies ==
== The Universal PUSH Lifecycle ==
=== Server‑Sent Events (SSE) ===
Lightweight one‑way PUSH over a long‑lived HTTP connection.
 
=== WebSockets ===
Full‑duplex real‑time communication.
 
=== MQTT ===
Pub/sub protocol designed for IoT and telemetry.
 
=== Long‑Polling ===
Held‑open requests until change.
 
=== Web Push API ===
Browser-side mechanism for receiving push notifications.
 
=== Web Push Protocol (RFC 8030) ===
Server-to-push-service protocol enabling browser push delivery.
 
== Universal PUSH Lifecycle ==
1. Discovery/Intent
2. Channel Establishment
3. Subscription Registration
4. Delivery
 
== When to Use What ==
* Use SSE for simple one‑way notifications.
* Use WebSockets for collaborative apps.
* Use MQTT for IoT/distributed messaging.
* Use Long‑polling for legacy compatibility.
* Use Web Push API for browser notifications.
* Use Web Push Protocol when interacting with push services.
 
== Deep Dive: Server‑Sent Events (SSE) ==
Server‑Sent Events (SSE) is a server → client streaming technology defined in the HTML Living Standard. Clients receive UTF‑8 encoded events over a long‑lived HTTP connection via the JavaScript `EventSource` interface. (Spec: WHATWG HTML — Server‑Sent Events)
 
=== How it Works ===
* Client opens a long‑lived HTTP GET request.
* Server streams events using `text/event-stream`.
* Events support `data:`, `id:` and `event:` fields.
* Browsers auto‑reconnect with `Last-Event-ID`.
 
=== Example ===
<pre>
id: 583
event: order_update
data: {"order":123,"status":"shipped"}
</pre>
 
== Deep Dive: WebSockets ==
WebSockets provide full‑duplex, low‑latency communication over a single TCP connection, standardised by IETF RFC 6455.
 
=== How it Works ===
WebSockets create a persistent, full‑duplex communication channel between a client and a server. The connection begins as a normal HTTP/1.1 request, but then upgrades to the WebSocket protocol as defined in IETF RFC 6455. This upgrade transforms the traditional request–response cycle into a continuous, bidirectional data stream. [1](https://pirho-my.sharepoint.com/personal/dex_pirho_net/Documents/Microsoft%20Copilot%20Chat%20Files/PUSH_Technologies_Deep_Dives_MediaWiki.txt)
 
==== 1. The Opening Handshake ====
The WebSocket workflow starts with an HTTP `GET` request sent from the client, containing special headers that request a protocol upgrade:
 
<pre>
GET /ws HTTP/1.1
Host: example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: (random base64 string)
Sec-WebSocket-Version: 13
</pre>
 
If the server supports WebSockets, it responds with a `101 Switching Protocols` message:
 
<pre>
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: (derived from Sec-WebSocket-Key)
</pre>
 
Once this handshake succeeds, **the connection is no longer HTTP** — it becomes a raw WebSocket channel. [1](https://pirho-my.sharepoint.com/personal/dex_pirho_net/Documents/Microsoft%20Copilot%20Chat%20Files/PUSH_Technologies_Deep_Dives_MediaWiki.txt)
 
==== 2. Framing and Continuous Communication ====
After the upgrade, both client and server exchange *WebSocket frames* instead of HTTP messages. RFC 6455 defines several frame types, including:
 
* **Text frames** — UTF‑8 payloads 
* **Binary frames** — arbitrary binary data 
* **Continuation frames** — fragmented message parts 
* **Ping/Pong frames** — keep‑alive and latency checks 
* **Close frames** — graceful shutdown 
 
Each message may be a single frame or span multiple frames, allowing very efficient, low‑latency transfers. [1](https://pirho-my.sharepoint.com/personal/dex_pirho_net/Documents/Microsoft%20Copilot%20Chat%20Files/PUSH_Technologies_Deep_Dives_MediaWiki.txt)
 
==== 3. Full‑Duplex Operation ====
Once active, a WebSocket connection allows both endpoints to:
 
* send data **independently**, without waiting for a request 
* send messages at any time 
* stream events instantly in either direction 
 
This makes the protocol ideal for scenarios such as live chat, collaboration tools, multiplayer updates, and dashboards — where the server needs to push updates without being polled. [1](https://pirho-my.sharepoint.com/personal/dex_pirho_net/Documents/Microsoft%20Copilot%20Chat%20Files/PUSH_Technologies_Deep_Dives_MediaWiki.txt)
 
==== 4. Maintaining the Connection ====
To keep the socket healthy:
 
* Clients or servers send **ping** frames 
* The recipient must reply with **pong** frames 
* Missed pings often indicate network failure 
* The connection may be closed with a controlled **close** frame 
 
These behaviours are explicitly defined in RFC 6455 as part of WebSocket’s reliability model. [1](https://pirho-my.sharepoint.com/personal/dex_pirho_net/Documents/Microsoft%20Copilot%20Chat%20Files/PUSH_Technologies_Deep_Dives_MediaWiki.txt)
 
==== 5. Closing the Connection ====
A WebSocket session ends with a `close` frame containing a close code and optional explanation. After a close handshake, both sides must stop sending frames and release the underlying TCP connection. [1](https://pirho-my.sharepoint.com/personal/dex_pirho_net/Documents/Microsoft%20Copilot%20Chat%20Files/PUSH_Technologies_Deep_Dives_MediaWiki.txt)
 
=== Framing ===
Supports text, binary, continuation, ping/pong and close frames.
 
== Deep Dive: MQTT v5 ==
MQTT v5 is a lightweight publish/subscribe messaging protocol optimised for constrained networks; it is an OASIS Standard.
 
=== How it Works ===
MQTT is a lightweight publish/subscribe messaging protocol designed for efficient communication across unreliable or bandwidth‑constrained networks. Its behaviour and wire format are defined in the OASIS MQTT v5.0 Standard, which specifies the client–server roles, message exchange patterns, quality-of-service levels, session control, and metadata features. [1](https://docs.racket-lang.org/rfc6455/index.html)
 
==== 1. Client–Broker Architecture ====
Unlike WebSockets or SSE, MQTT does not create a direct connection between publishers and subscribers. Instead, all communication flows through a central **broker**:
 
* Clients publish messages to named **topics** 
* Subscribers express interest in one or more topics 
* The broker routes messages from publishers to all matching subscribers 
 
This architecture decouples senders and receivers in space, time, and execution flow. It is core to MQTT’s suitability for IoT, telemetry, and distributed systems. [1](https://docs.racket-lang.org/rfc6455/index.html)
 
==== 2. Establishing the Connection ====
MQTT uses a persistent TCP connection (or any reliable, ordered, bi‑directional transport). 
A client begins by sending a **CONNECT** packet, which includes:
 
* protocol version 
* client identifier 
* optional username/password 
* session expiry interval 
* authentication data 
* Will message (optional message sent on disconnect) 
 
If the broker accepts the session, it responds with a **CONNACK** containing reason codes and connection parameters. These values follow the v5.0 specification. [1](https://docs.racket-lang.org/rfc6455/index.html)
 
==== 3. Subscribing to Topics ====
To receive messages, the client sends a **SUBSCRIBE** packet specifying:
 
* topic filters (e.g., `sensors/temperature`) 
* desired QoS level 
* optional subscription identifiers 
* optional user properties 
 
The broker acknowledges with **SUBACK**, including success/failure reason codes for each subscription. Topic filters may include wildcards, enabling expressive and flexible subscription patterns. [1](https://docs.racket-lang.org/rfc6455/index.html)
 
==== 4. Publishing Messages ====
Messages are published with a **PUBLISH** packet, containing:
 
* topic name 
* payload 
* QoS level 
* retain flag 
* user properties 
* correlation data (for request/response patterns) 
 
The broker forwards the message to all clients subscribed to the topic.
 
MQTT v5 supports three QoS modes:
 
* **QoS 0 – At most once** (fire‑and‑forget) 
* **QoS 1 – At least once** (acknowledged delivery) 
* **QoS 2 – Exactly once** (two‑phase handshake for guaranteed delivery) 
 
These delivery controls are explicitly defined in the v5.0 standard. [1](https://docs.racket-lang.org/rfc6455/index.html)


==== 5. Session & State Management ====
Regardless of the technology, PUSH systems follow a similar sequence:
MQTT v5 introduces advanced session features, including:


* **Session expiry** (persistent or ephemeral sessions)   
# '''Intent / Discovery''' 
* **Reason codes** for all acknowledgements 
  The client declares interest (“I want updates for X.”)
* **Flow control**  
# '''Channel Establishment'''  
* **Request/response correlation**  
  A connection or subscription pipeline is created.
* **Topic aliases** to reduce packet size 
# '''Subscription Registration'''  
  The server/broker maps the client to topics, routes, or events.
# '''Delivery'''  
  Events are pushed without polling.


Clients may reconnect and resume sessions depending on the session expiry interval.
Technologies differ only in how they perform these steps.
If a session is persistent, the broker stores pending messages while the client is offline. [1](https://docs.racket-lang.org/rfc6455/index.html)


==== 6. Heartbeats & Liveness ====
== When to Use Which Technology ==
MQTT maintains connection health through the **Keep Alive** timer:


* Client specifies a heartbeat interval  
* '''Use SSE''' when you need simple, reliable one‑way streaming over HTTP.  
* Broker expects traffic at least once per interval  
* '''Use WebSockets''' when both sides must send events at any time. 
* If no packets arrive, the broker closes the connection 
* '''Use MQTT''' when you need scalable pub/sub or IoT‑style routing. 
* '''Use Long‑Polling''' for maximum compatibility with legacy environments.  
* '''Use the Web Push API''' for system‑level browser notifications. 
* '''Use the Web Push Protocol''' when communicating with push services.


Clients also monitor **DISCONNECT** frames, which may include explanatory reason codes as defined in the v5.0 specification. [1](https://docs.racket-lang.org/rfc6455/index.html)
== High‑Level Architectural Considerations ==


==== 7. Closing the Connection ====
=== Scalability ===
A client may gracefully end the session by sending **DISCONNECT**, optionally specifying:
* SSE and WebSockets require persistent connections at scale. 
* MQTT brokers handle very large fan‑out and dynamic topic routing. 
* Web Push offloads scaling to the browser vendor’s push service. 


* session expiry  
=== Security ===
* user properties  
* All modern PUSH channels require TLS.  
* reason codes (e.g., normal disconnect, error conditions)  
* Web Push enforces encrypted payloads even after leaving your server.  
* MQTT requires careful ACL and topic‑level access design.   


The broker may also send DISCONNECT if protocol violations occur. [1](https://docs.racket-lang.org/rfc6455/index.html)
=== Backwards Compatibility ===
* Long‑Polling remains the universal fallback.
* SSE degrades to long‑polling in some environments.
* WebSockets require explicit upgrade support.


=== Key Features ===
=== Operational Lifecycle ===
QoS levels, user properties, will messages, shared subscriptions.
* WebSockets require heartbeat handling. 
* MQTT requires broker management and topic governance. 
* Web Push requires subscription renewal logic.


== Deep Dive: Long‑Polling ==
== Linked Deep‑Dive Articles ==
Long‑polling simulates PUSH over repeated held HTTP requests.


=== Flow ===
For full technical detail, see the following dedicated articles:
1. Client opens request.<br/>
2. Server holds connection until event.<br/>
3. Client reconnects.


== Deep Dive: Web Push API (W3C) ==
* [[PUSH: Server‑Sent Events (SSE)]] 
The Push API enables web apps to receive messages when not active, via Service Workers and a browser push service. (W3C latest published version)
* [[PUSH: WebSockets]] 
* [[PUSH: MQTT v5]] 
* [[PUSH: Long‑Polling]] 
* [[PUSH: Web Push API]] 
* [[PUSH: Web Push Protocol (RFC 8030)]]


=== Flow ===
Each sub‑article includes:
1. Register Service Worker.<br/>
* protocol flows 
2. Subscribe via `PushManager.subscribe()`.<br/>
* wire‑level behaviour 
3. Browser obtains endpoint.<br/>
* lifecycle diagrams 
4. Service Worker receives notifications.
* example frames/messages 
* deployment considerations 
* common pitfalls and diagnostics 


== Deep Dive: Web Push Protocol (RFC 8030) ==
== Related Topics ==
RFC 8030 defines the HTTP‑based protocol used by application servers to send push messages to push services, which then deliver them to user agents.


=== How it Works ===
* [[Real‑Time Systems]]
* App server sends (encrypted) message to a push service over HTTP/2.
* [[Event‑Driven Architecture]]
* Push service stores and forwards to the user agent when reachable.
* [[Polling vs PUSH Models]]
* Browser wakes the Service Worker `onpush` handler to process the message.
* [[Distributed Messaging Patterns]]


== References ==
== Categories ==
* [https://html.spec.whatwg.org/multipage/server-sent-events.html Server-Sent Events — WHATWG]
* [https://www.rfc-editor.org/rfc/rfc6455 WebSockets — IETF RFC 6455]
* [https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html MQTT v5 — OASIS]
* [https://www.w3.org/TR/push-api/ Push API — W3C]
* [https://www.rfc-editor.org/rfc/rfc8030 Web Push Protocol — IETF RFC 8030]


[[Category:Architecture]] [[Category:Standards]] [[Category:Real-Time Systems]] [[Category:Dex White]]
[[Category:Architecture]]
[[Category:Standards]]
[[Category:Real-Time Systems]]
[[Category:Messaging]] 
[[Category:Dex White]]

Latest revision as of 16:42, 14 March 2026

PUSH technologies allow servers to deliver updates to clients the moment something meaningful happens. Unlike traditional request/response patterns, PUSH reverses the flow: the server becomes the initiator.

This article provides a clear architectural overview of the major PUSH mechanisms, how they behave, where they fit, and how to choose between them. Deep‑dive technical articles for each protocol are linked throughout.

Why PUSH Matters

Modern systems increasingly expect events to arrive instantly. Users no longer tolerate:

  • polling delays
  • stale dashboards
  • race conditions between systems
  • manual refresh cycles

PUSH solves these challenges by establishing:

  • a persistent or semi‑persistent communication channel
  • a subscription or routing mechanism
  • an event‑triggered delivery engine

PUSH enables:

  • real‑time dashboards
  • collaborative experiences
  • workflow updates
  • IoT telemetry
  • notification ecosystems
  • cross‑system synchronisation

The Major PUSH Technologies

This overview covers the six primary PUSH families used across web, mobile, and IoT systems:

  • Server‑Sent Events (SSE) — one‑way server → client streaming
  • WebSockets — full‑duplex, bidirectional communication
  • MQTT v5 — IoT‑focused publish/subscribe messaging
  • Long‑Polling — legacy, simulated PUSH using held HTTP requests
  • Web Push API — browser notifications delivered via Service Workers
  • Web Push Protocol (RFC 8030) — server → push service → browser channel

Each solves a different architectural problem. None replaces the others.

Summary Comparison Table

Technology Directionality Ideal Use Cases Complexity
SSE Server → Client Notifications, dashboards, workflow events Low
WebSockets Full‑duplex Chat, collaboration, presence, shared editing Medium–High
MQTT v5 Publish/Subscribe IoT, telemetry, distributed systems Medium
Long‑Polling Simulated PUSH Legacy fallback, older browsers/servers Low
Web Push API Server → Browser (via SW) Notifications when app is closed Medium
Web Push Protocol (RFC 8030) Server → Push Service → Browser Reliable background delivery Medium

The Universal PUSH Lifecycle

Regardless of the technology, PUSH systems follow a similar sequence:

  1. Intent / Discovery
  The client declares interest (“I want updates for X.”)
  1. Channel Establishment
  A connection or subscription pipeline is created.
  1. Subscription Registration
  The server/broker maps the client to topics, routes, or events.
  1. Delivery
  Events are pushed without polling.

Technologies differ only in how they perform these steps.

When to Use Which Technology

  • Use SSE when you need simple, reliable one‑way streaming over HTTP.
  • Use WebSockets when both sides must send events at any time.
  • Use MQTT when you need scalable pub/sub or IoT‑style routing.
  • Use Long‑Polling for maximum compatibility with legacy environments.
  • Use the Web Push API for system‑level browser notifications.
  • Use the Web Push Protocol when communicating with push services.

High‑Level Architectural Considerations

Scalability

  • SSE and WebSockets require persistent connections at scale.
  • MQTT brokers handle very large fan‑out and dynamic topic routing.
  • Web Push offloads scaling to the browser vendor’s push service.

Security

  • All modern PUSH channels require TLS.
  • Web Push enforces encrypted payloads even after leaving your server.
  • MQTT requires careful ACL and topic‑level access design.

Backwards Compatibility

  • Long‑Polling remains the universal fallback.
  • SSE degrades to long‑polling in some environments.
  • WebSockets require explicit upgrade support.

Operational Lifecycle

  • WebSockets require heartbeat handling.
  • MQTT requires broker management and topic governance.
  • Web Push requires subscription renewal logic.

Linked Deep‑Dive Articles

For full technical detail, see the following dedicated articles:

Each sub‑article includes:

  • protocol flows
  • wire‑level behaviour
  • lifecycle diagrams
  • example frames/messages
  • deployment considerations
  • common pitfalls and diagnostics

Related Topics

Categories