Long Polling
Long polling is a technique where the client sends an HTTP request and the server holds the connection open until new data is available or a timeout occurs, then the client immediately opens the next request. It simulates server push over plain HTTP.
Technical Architecture & Deep-Dive
Short polling wastes requests: the client asks every few seconds whether anything changed. Long polling reduces empty responses by waiting on the server until an event arrives or a keep-alive window expires.
Long polling works through corporate proxies and older browsers that block WebSockets, but it ties up server threads and scales poorly under many concurrent waiters. Teams often migrate to WebSockets or webhooks for production traffic, using an edge BFF to unify authentication while clients still speak simple HTTP.
Key Architectural Benefits
Implement Long Polling at the Edge
Deploy lightweight API aggregation, edge caching, and secret injection in minutes without Docker containers or complex servers.
Frequently Asked Questions
Q:How is long polling different from server-sent events?
Server-sent events keep one long-lived connection for one-way server push. Long polling completes each request after data arrives and opens a new one, mimicking push with standard request-response cycles.
Related Architecture Concepts
A WebSocket API keeps an open, bidirectional TCP connection between client and server so both sides can send messages at any time without opening a new HTTP request per event. It suits live dashboards, chat, collaborative editing, and streaming AI tokens.
A webhook is an HTTP callback: when an event occurs in one system, it sends an HTTP POST with event data to a URL you register. Instead of polling an API repeatedly for changes, your application receives updates in real time, such as payment succeeded or ticket created events.
A REST API is a web interface that exposes data as resources identified by URLs and manipulated with standard HTTP methods such as GET, POST, PUT, and DELETE. Each request is stateless and responses are usually JSON, making REST the most common style for public and internal APIs.
Event-driven architecture is a design approach where services communicate by producing and consuming events, such as order placed or subscription canceled, rather than calling each other synchronously. Consumers react to events independently, which decouples systems and improves resilience.
Ready-to-Use Edge Recipes
Fix "how to create mobile friendly api from legacy rest service" by pointing Mobile App (iOS & Android) at RealComposer. Vault secrets authenticate https://jsonplaceholder.typicode.com/users/{{query.userId}}; client tokens gate your public URL.
Edge receives Paddle webhook and updates Supabase in one flow. For "paddle webhook and supabase user sync edge", store PADDLE_API_KEY, SUPABASE_SERVICE_ROLE_KEY in Secret Vault, call https://api.paddle.com/subscriptions/{{query.subscriptionId}} from a Worker, and let Any Frontend / Mobile hit only https://realcomposer.com/v1/workspace/paddle-webhook-supabase-sync-edge with an rc_live_ client token.