# Azure Web PubSub

Azure Web PubSub is a managed service for real-time, bidirectional messaging over WebSockets using publish-subscribe patterns.

Cloud service · Azure. Updated 2026-11-25. Page: https://blowstack.com/tools/cloud-services-hub/azure-web-pubsub

> Azure Web PubSub manages persistent client connections and message fan-out for web, mobile, and other connected applications. Applications use hubs, groups, users, and events to route updates while retaining control over authentication, business logic, and persistence. It also offers a Socket.IO development experience and preview support for a subset of MQTT over WebSocket.

## 9 key features of Azure Web PubSub

1. **Managed WebSocket connections**: Maintain persistent client connections without operating a WebSocket server fleet. Backend workers and APIs can scale separately from connected clients.
2. **Targeted message routing**: Send messages to all connections in a hub, a group, a user, or a specific connection. Use groups for application audiences such as document collaborators or subscribers to a particular asset.
3. **Authorized client publish-subscribe**: Clients using supported subprotocols can join groups and publish directly when their access tokens grant the necessary permissions. Limit these permissions to authorized audiences, and route sensitive operations through application handlers.
4. **Upstream event handlers**: Forward configured connection and client events to application HTTP endpoints or Azure Functions. Use handlers to validate incoming actions, apply business rules, and coordinate downstream work.
5. **Socket.IO support**: The dedicated Socket.IO capability manages connection infrastructure and coordination across application servers. It preserves the Socket.IO programming model while reducing the infrastructure required for multi-server deployments.
6. **MQTT over WebSocket in preview**: Connect MQTT clients over WebSocket and exchange supported messages with native Web PubSub clients. This is a limited protocol adaptation: wildcard subscriptions, retained messages, shared subscriptions, and topic aliases are not supported.
7. **Identity and network controls**: Use Microsoft Entra ID and Azure RBAC for supported backend operations, and apply private endpoints and network access rules to restrict exposure. Client connections still require an application-designed authentication and authorization flow.
8. **Premium scaling and resilience**: Premium supports metric-based or scheduled autoscale, zone redundancy in supported regions, and geo-replication. Size deployments against both connection demand and messaging workload, and implement client recovery for disruptions.
9. **Operational visibility**: Service metrics expose connection counts, quota utilization, server load, traffic, and request outcomes. Use diagnostic logs and development tracing to investigate failed connections, authorization errors, and message-routing problems.

## Where Azure Web PubSub is used

1. **Live operational dashboards**: Push equipment status, financial indicators, or workflow changes to browsers subscribed to relevant groups. Load an authoritative snapshot through an API before applying incremental updates.
2. **Collaborative applications**: Distribute cursor movement, presence signals, and document-change notifications to participants in a shared session. Keep conflict resolution, durable document state, and access checks in the application.
3. **Chat and session messaging**: Use groups to distribute messages among participants and user targeting to notify all of a user's connected devices. When using the base service, implement membership policy, moderation, and durable history in the backend.
4. **User-specific notifications**: Deliver job completion, order status, or approval updates to connected users without polling. Persist notifications separately when users must see updates received while offline.
5. **Multiplayer coordination**: Exchange lobby changes, turn updates, and room-level game events. Keep authoritative game rules on trusted compute and benchmark latency and throughput against the game's requirements.
6. **AI response streaming**: Relay generated text fragments and progress events from backend inference workflows to an authorized client or conversation group. Include request identifiers and cancellation handling so clients can distinguish concurrent responses.

## How Azure Web PubSub is priced

- **Free tier**: A limited-capacity tier supports development, evaluation, and small experiments within its connection and messaging allowances. It is not intended to provide production availability guarantees.
- **Standard tier**: Paid capacity is provisioned in units, with connection capacity and included messaging allowances determined by the selected SKU and unit count. Outbound messaging above the included allowance is billed according to the applicable rate; fan-out and message size affect metered message volume.
- **Premium tier**: Premium uses paid provisioned capacity and messaging meters while adding capabilities such as autoscale, zone redundancy in supported regions, and geo-replication. Budget for the configured capacity of each replica and check regional SKU availability, quotas, and rates before deployment.

## Services Azure Web PubSub works with

A common architecture places an authenticated API in Azure App Service or Azure Functions in front of the connection-establishment flow. The API checks application permissions and returns a short-lived client access URL. Clients then connect directly to Web PubSub, while backend services publish through SDKs or REST APIs. Configured upstream handlers receive client events that require server-side validation or processing.

For event-driven applications, retain durable processing in services such as Azure Service Bus and use a consumer to translate business events into targeted live notifications. Event Hubs consumers can aggregate telemetry before publishing dashboard updates. Cosmos DB can hold authoritative state and history, with a change feed processor announcing committed changes. These are application-mediated integrations rather than automatic delivery guarantees across services.

Design reconnect behavior around a snapshot API or durable history store, because live delivery alone does not synchronize clients that were offline. Include identifiers and versions in updates so clients can reconcile state. Use managed identities and appropriate roles for backend access where supported, and monitor both Web PubSub and its application dependencies through Azure Monitor. Scale message-processing compute independently from connection capacity, and test the complete path under fan-out peaks.

- **[Azure Functions](https://blowstack.com/tools/cloud-services-hub/azure-functions)**: Use Azure Functions bindings and triggers to issue client access information, handle Web PubSub events, and publish messages. For example, an authenticated HTTP function can authorize a dashboard subscription while a queue-triggered function sends job progress to the user's connections. Keep callback processing short and move lengthy work to asynchronous processing.
- **[App Service](https://blowstack.com/tools/cloud-services-hub/app-service)**: Host the application API and negotiation endpoint in App Service while clients maintain their WebSocket connections directly with Web PubSub. For example, an order-management API can validate a user's access and publish order changes through the service SDK. A managed identity with an appropriate Web PubSub data-plane role can reduce reliance on stored service keys.
- **[Service Bus](https://blowstack.com/tools/cloud-services-hub/service-bus)**: Use a backend consumer to translate durable Service Bus messages into real-time client updates. For example, a worker can consume an OrderShipped event and notify the corresponding user's active sessions. Service Bus supplies durable backend delivery; Web PubSub supplies live fan-out, so retain a separate state or notification store for offline clients.
- **[Event Hubs](https://blowstack.com/tools/cloud-services-hub/event-hubs)**: Process streaming events with a consumer application and publish selected or aggregated results to Web PubSub groups. For example, a telemetry processor can summarize sensor readings per facility and update subscribed dashboards once per second. Avoid forwarding an entire high-volume stream to every client without filtering, aggregation, and capacity testing.
- **[Azure Cosmos DB](https://blowstack.com/tools/cloud-services-hub/azure-cosmos-db)**: Store authoritative application state or message history in Cosmos DB and use a change feed processor to publish committed changes. For example, a processor can notify a project group when a task document changes. Include document versions or event identifiers so clients can reconcile repeated or out-of-order application updates.
- **[Azure Monitor](https://blowstack.com/tools/cloud-services-hub/azure-monitor)**: Create Azure Monitor alerts for connection utilization, server load, and request failures, and send supported diagnostic logs to a Log Analytics workspace. For example, alert before connection capacity is exhausted and correlate failed client connections with backend negotiation errors. Premium deployments can also use Azure Monitor autoscale rules to adjust capacity.
- **[API Management](https://blowstack.com/tools/cloud-services-hub/api-management)**: Azure Web PubSub can serve as the backend for an API Management WebSocket API. API Management applies configured policies to the initial HTTP handshake and then proxies the established WebSocket connection to Web PubSub.
- **[Azure Application Gateway](https://blowstack.com/tools/cloud-services-hub/azure-application-gateway)**: Azure Web PubSub can receive client WebSocket connections through Application Gateway. The gateway can forward traffic to a Web PubSub private endpoint, so clients can connect through the gateway while public network access to Web PubSub is disabled.
- **[Azure Blob Storage](https://blowstack.com/tools/cloud-services-hub/azure-blob-storage)**: Azure Web PubSub can archive connectivity, messaging, and HTTP request logs in Blob Storage through its diagnostic settings. For example, you can retain connect and disconnect records for later troubleshooting.
- **[Azure DNS](https://blowstack.com/tools/cloud-services-hub/azure-dns)**: Azure Web PubSub private endpoints can use the Azure Private DNS zone `privatelink.webpubsub.azure.com`. Clients in linked virtual networks can then use the normal Web PubSub hostname and resolve it to the private endpoint's IP address.
- **[Azure Front Door](https://blowstack.com/tools/cloud-services-hub/azure-front-door)**: Azure Web PubSub can be configured as an origin for a WebSocket-enabled Front Door route. Clients connect to the Front Door hostname, and Front Door proxies their WebSocket connections to Web PubSub.
- **[Azure Key Vault](https://blowstack.com/tools/cloud-services-hub/azure-key-vault)**: Azure Web PubSub can use a certificate stored in Key Vault to serve TLS traffic on a custom domain. A managed identity on the Web PubSub resource lets it retrieve the certificate without embedding credentials in application code.
- **[Azure Kubernetes Service (AKS)](https://blowstack.com/tools/cloud-services-hub/azure-kubernetes-service-(aks))**: Azure Web PubSub is a supported target for Service Connector on AKS. The connection configures the Web PubSub endpoint and authentication settings for a Kubernetes workload, so it can publish messages without hard-coding a connection string.
- **[Azure Policy](https://blowstack.com/tools/cloud-services-hub/azure-policy)**: Azure Web PubSub supports built-in Azure Policy definitions for settings such as public network access and local authentication. For example, a policy can flag instances that still allow access-key authentication.
- **[Azure portal](https://blowstack.com/tools/cloud-services-hub/azure-portal)**: Azure Web PubSub has a resource management page in the Azure portal where you can configure hubs, event handlers, networking, and diagnostic settings. You can also launch Live Trace there to investigate connection or messaging problems as they happen.
- **[Azure Private Link](https://blowstack.com/tools/cloud-services-hub/azure-private-link)**: Azure Web PubSub supports Private Link endpoints for private client and application access. Once a private endpoint is configured, you can disable the public endpoint and reach the service over a private IP address.
- **[Azure Resource Manager](https://blowstack.com/tools/cloud-services-hub/azure-resource-manager)**: Azure Resource Manager can provision Azure Web PubSub instances as `Microsoft.SignalRService/webPubSub` resources. Templates can also deploy child resources such as hubs and replicas alongside the instance.
- **[Azure role-based access control (Azure RBAC)](https://blowstack.com/tools/cloud-services-hub/azure-role-based-access-control-(azure-rbac))**: Azure Web PubSub uses Azure RBAC to grant Microsoft Entra principals access to its resources and data-plane operations. For example, the Web PubSub Service Owner role lets an application's managed identity publish messages without using an access key.
- **[Azure Service Health](https://blowstack.com/tools/cloud-services-hub/azure-service-health)**: Azure Web PubSub exposes instance availability through the Resource Health component of Azure Service Health. Operators can use it to check whether a messaging disruption coincides with an Azure platform issue affecting the resource.
- **[Azure Spring Apps](https://blowstack.com/tools/cloud-services-hub/azure-spring-apps)**: Azure Web PubSub is a supported Service Connector target for Azure Spring Apps. A connection can supply a Spring application's Web PubSub hostname and configure managed identity authentication instead of passing a shared access key.
- **[Azure Virtual Network](https://blowstack.com/tools/cloud-services-hub/azure-virtual-network)**: Azure Web PubSub can be reached through a private endpoint in an Azure Virtual Network subnet. For example, an application backend on the virtual network can publish messages to Web PubSub without using the service's public endpoint.
- **[Azure Web Application Firewall](https://blowstack.com/tools/cloud-services-hub/azure-web-application-firewall)**: Azure Web PubSub traffic can be placed behind Web Application Firewall on Application Gateway or Front Door. The firewall can inspect and apply rules to the initial HTTP upgrade request, but it does not inspect messages inside an established WebSocket connection.
- **[Microsoft Entra ID (formerly Azure AD)](https://blowstack.com/tools/cloud-services-hub/microsoft-entra-id-(formerly-azure-ad))**: Azure Web PubSub accepts Microsoft Entra access tokens for authenticated service operations. A backend can use a managed identity or service principal to publish messages and manage client groups without storing a Web PubSub access key.
- **[Static Web Apps](https://blowstack.com/tools/cloud-services-hub/static-web-apps)**: Azure Web PubSub can provide real-time messaging for a Static Web Apps site through an Azure Functions API with Web PubSub bindings. In a chat app, the API can issue connection URLs and publish messages, while browsers connect directly to Web PubSub over WebSocket.

## Alternatives to Azure Web PubSub in other clouds

### AWS

**[Amazon API Gateway](https://blowstack.com/tools/cloud-services-hub/amazon-api-gateway)**: Both services manage WebSocket connections for real-time, two-way communication. Amazon API Gateway also publishes HTTP and REST APIs and bills WebSocket usage by messages and connection minutes, while Azure Web PubSub focuses on publish-subscribe messaging and bills paid tiers for provisioned capacity and metered messaging.

| | Azure Web PubSub | Amazon API Gateway |
| --- | --- | --- |
| Service scope | WebSocket publish-subscribe messaging | HTTP, REST, and WebSocket APIs |
| Paid WebSocket billing | Capacity units and metered messaging | Messages and connection minutes |
| Automatic scaling | Autoscale on Premium | Automatic with incoming traffic |

Compared Nov 2026.

**[AWS AppSync](https://blowstack.com/tools/cloud-services-hub/aws-appsync)**: AppSync Events, part of AWS AppSync, and Azure Web PubSub both provide managed WebSocket publish-subscribe messaging. AppSync Events bills for API operations and connection minutes, while Azure Web PubSub’s paid tiers bill for provisioned capacity and meter messaging.

| | Azure Web PubSub | AWS AppSync |
| --- | --- | --- |
| Paid billing model | Provisioned units and messaging | API operations and connection minutes |

Compared Nov 2026.

## What is Azure Web PubSub

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.
