RealComposer
Architecture & BFF

WebSocket API

Direct Definition

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.

Technical Architecture & Deep-Dive

HTTP is request-response: the client must poll or use server-sent events for server-pushed updates. WebSockets upgrade a single HTTP handshake into a long-lived socket, lowering latency and header overhead for high-frequency messages.

Browsers and mobile apps still need authentication, rate limits, and stable URLs while upstream WebSocket servers may sit behind firewalls or expose internal hosts. An edge gateway can terminate TLS, validate tokens, and proxy frames to the origin so clients connect to one public endpoint.

Key Architectural Benefits

Delivers sub-second server push without repeated HTTP round trips.
Reduces bandwidth compared to short polling for chatty interfaces.
Supports bidirectional messaging for collaborative and control flows.
REALCOMPOSER EDGE WORKSPACE

Proxy Streaming APIs at the Edge

Terminate TLS, inject secrets, and forward live streams without exposing upstream sockets to every client.

LAUNCH TOOL

Frequently Asked Questions

Q:When should I use WebSockets instead of REST?

Use WebSockets when the server must push many updates or the client sends frequent small messages. REST remains better for cacheable CRUD and simple request-response workflows.

Q:Can an edge proxy sit in front of WebSockets?

Yes. Edge runtimes can upgrade connections, authenticate clients, and forward WebSocket frames to upstream servers while hiding internal endpoints.

Related Architecture Concepts

Ready-to-Use Edge Recipes