FIELD NOTESAZURE · ARCHITECTURE

Real-time push on Azure: Web PubSub or SignalR Service

SignalR Service when the app and every client already speak SignalR; Web PubSub for plain WebSocket, Socket.IO or MQTT clients. Both cost $1.61 a unit a day, so count the fan-out, and poll when users wait for one answer.

By Kevin4 min readPublished
ON THIS PAGE
Three routes to a screen on Azure: SignalR clients through SignalR Service with hub servers attached, WebSocket and MQTT clients through Web PubSub calling a Functions event handler, and a browser polling a status endpoint. Drawn in archhy.

Choose by what your clients speak, because the price will not choose for you: both services charge the same per unit, connection and message. If the app is already ASP.NET Core SignalR and every client has a supported SignalR library, put Azure SignalR Service under it. If clients speak plain WebSocket, Socket.IO or MQTT, or a language SignalR does not support, use Azure Web PubSub. If the user awaits one answer rather than watching something change, poll.

The client decides#

SignalR Service scales out one protocol: hubs, calls both ways, streaming, and a client library that falls back to server-sent events or long polling when a proxy blocks WebSockets, and reconnects for you. An existing app moves across with a NuGet package, a connection string and AddSignalR().AddAzureSignalR(). The catch is that every client needs that library, and Microsoft supports four: JavaScript, .NET, Java and Swift. A C++ game client or a Python worker has no supported option.

Web PubSub starts from the socket. Anything that can open a WebSocket connects with a token your server signs, and the service keeps users and groups, so you can reach a room, or every tab one person has open, without storing connection IDs. Socket.IO and MQTT over WebSocket sit on top. The MQTT support is still in preview, without wildcard subscriptions, retained messages or shared subscriptions; for devices, look at Event Grid's MQTT broker instead.

TypeScript
// Web PubSub: a plain socket; your /negotiate returns a signed URL
const { url } = await (await fetch("/negotiate")).json();
const ws = new WebSocket(url);
ws.onmessage = (e) => render(JSON.parse(e.data));

// SignalR Service: the SignalR client picks a transport and reconnects
const hub = new signalR.HubConnectionBuilder()
  .withUrl("/hubs/orders").withAutomaticReconnect().build();
hub.on("orderChanged", render);
await hub.start();

The first half has no Azure library in it, which is the point, and no reconnect logic, which is the cost. Web PubSub's client SDK fills the gap: its reliable subprotocol resumes the session, groups included, if the client returns within about a minute.

Where your backend sits, and how it fails#

In SignalR Service's Default mode your hub servers hold connections to the service, five per hub per server to start, and each client stays pinned to one of them. Per-connection state is safe, but no client can connect while no hub server is attached, and restarting a server drops every client pinned to it. Serverless mode swaps hub servers for Azure Functions bindings, but hearing from clients there needs upstream endpoints, which Microsoft's FAQ still calls a public preview.

Web PubSub holds no connection to your servers. It posts CloudEvents to an HTTP event handler you register for connect, disconnect and every client message. That suits Azure Functions or any stateless service, with two catches. Connect and message events wait for your answer, so a slow handler is latency every user feels, and an error reply to a message closes that client's connection. The webhook traffic is billed as outbound messages too.

What it costs: the same, so count the fan-out#

The two pricing pages match line for line (checked 22 November 2026; US dollars, identical in US East, UK South and West Europe). Free stops at 20 connections, with no SLA. Standard is $1.61 per unit per day; Premium is $2.00 and adds availability zones, autoscale, geo-replication and a 99.95 % SLA. A unit holds 1,000 connections and includes 1 million messages a day, then $1.00 per million. Only outbound traffic is billed, in messages of up to 2 KB, so each broadcast is paid once per recipient.

Take an operations board watched by 4,000 people through a ten-hour shift, with a 2 KB snapshot every five seconds. Keeping units at most 80 % used, as Microsoft suggests, means 5 units: $8.05 a day. The snapshots are 7,200 broadcasts to 4,000 screens, 28.8 million messages; 5 million are included, so the rest cost $23.80. That is $31.85 a day, about $955 for a 30-day month, three quarters of it fan-out. Halving the update rate cuts the message line to $9.40; a bigger tier cuts nothing. And after 10 units the next size is 20, so at that margin the 8,001st viewer doubles the unit bill.

When polling is honestly enough#

Ask what the user does while they wait. Someone watching a chat or a price needs push; someone waiting for one export or payment does not. For them, the Azure Architecture Center's asynchronous request-reply pattern is enough: answer 202 Accepted with a Location to poll and a Retry-After saying how often, from the app you already run. The smallest production push setup costs $48.30 for a 30-day month before a single message, plus a negotiate endpoint and reconnect handling. Push when updates outpace any sensible poll interval, or clients talk back. The same test applies one layer down.

On AWS and Google Cloud#

AWS splits the same way: AppSync Events has the Web PubSub shape, channels with managed fan-out, while API Gateway WebSocket APIs leave the connection table to you. Google Cloud has no managed equivalent; its guidance is to hold sockets on Cloud Run, where a request lasts at most 60 minutes, and keep instances in step through Memorystore Redis pub/sub or Firestore real-time updates. Neither offers a managed SignalR service, a fair reason for a SignalR app to stay on Azure. Upstream of all this, the event-driven pillar for Azure sorts out Service Bus and Event Grid.

The diagram#

Three routes to a screen: SignalR clients through SignalR Service and its hub servers, WebSocket and MQTT clients through Web PubSub and a Functions handler, and a browser polling a status endpoint. Open it in archhy and make a copy to adapt it.