Azure Web PubSub separates long-lived client connections from application processing. Clients connect directly to the service over WebSockets, while application servers use service SDKs or REST APIs to send messages and manage connections. This architecture lets application compute scale independently from the infrastructure maintaining connected browsers and devices. It is useful when applications need immediate updates rather than repeated HTTP polling.
The base service organizes connections into hubs. Each connection belongs to one hub, and groups within that hub identify subsets of connections that should receive the same messages. A user identifier can associate multiple connections with one application user, such as connections from several browser tabs or devices. Use a small, predetermined set of hubs for application scenarios and groups for dynamic audiences such as projects, sessions, or dashboard subscriptions. Hubs and groups are routing constructs, not substitutes for application authorization.
A typical connection flow starts at an authenticated application endpoint. The backend validates the caller and issues a short-lived client access URL containing a token scoped to the required hub, user, and permissions. The client then connects directly to Web PubSub. Keep service access keys and connection strings on trusted servers, never in browser code. Backend applications can use Microsoft Entra ID credentials and Azure role-based access control for supported service operations instead of distributing shared keys.
Applications can send to an entire hub, a group, a user, or an individual connection. With an appropriate subprotocol and permissions, clients can publish directly to groups without routing every message through application compute. When validation or business processing is required, configure upstream event handlers to receive client events through HTTP callbacks. Account for callback authentication, response time, and failure handling when designing these handlers.
The base service provides real-time transport rather than a durable event log or application database. Store authoritative state and message history separately, and define how clients obtain a fresh snapshot after a disconnect. Supported reliable client protocols provide bounded connection recovery, but this does not replace durable replay. Use application sequence numbers, idempotent processing, and state reconciliation where missed or repeated updates would affect correctness.
Choose capacity using concurrent connections, message sizes, fan-out, and measured server load rather than connection count alone. Premium supports autoscale, zone redundancy in supported regions, and geo-replication. Monitor utilization and connection failures, and test reconnect behavior during scaling and regional disruption. Socket.IO applications should use the dedicated Socket.IO capability rather than assume wire compatibility with the base WebSocket endpoint. MQTT support remains a preview adaptation over WebSocket and does not provide a complete MQTT broker.