Skip to main content
Azure
  • 3 min read

Easily build real-time apps with WebSockets and Azure Web PubSub—now in preview

Today, we are announcing the preview of the Azure Web PubSub service for building real-time web applications with WebSockets. WebSocket is a standardized protocol that provides full-duplex communication. It is key to building efficient real-time web interactions and is supported by all major browsers as well as web servers.

Real-time application scenarios such as chat for streaming videos, interactive whiteboards for remote education, and IoT dashboards are becoming ever more popular. Businesses are keen to build such applications for enhanced user experiences and real-time interactions with end customers.

Today, we are announcing the preview of the Azure Web PubSub service for building real-time web applications with WebSockets. WebSocket is a standardized protocol that provides full-duplex communication. It is key to building efficient real-time web interactions and is supported by all major browsers as well as web servers. Azure Web PubSub enables you to use WebSockets and the publish-subscribe pattern to easily build real-time web applications, like live monitoring dashboards, cross-platform live chat, real-time location on maps, and more.

Azure Web PubSub service usage scenarios

Figure 1: Azure Web PubSub service usage scenarios

Fully managed, globally available

Real-time scenarios often require high-frequency data flows and large quantities of concurrent connections between the client and server. For example, a finance app to visualize market data may need up to 100,000 connections and live data with low latency in milliseconds. A non-trivial infrastructure setup is required to get such functionality up and running at scale. To implement a WebSocket-based real-time experience, a developer would first need to set up infrastructure for handling client connections, establish mechanisms to scale it on demand and ensure the setup is able to meet business SLA requirements. This infrastructure management takes away a developer’s time from focusing on end-user experiences, and we built Azure Web PubSub service to solve this. The service offers built-in support for large-scale client connections and highly available architectures so that developers can focus on the application logic that delivers real-time connected experiences. 

Azure Web SubPub portal

Figure 2: Azure Web PubSub service in Azure portal

Native WebSocket support

The Azure Web PubSub service supports native WebSocket and a wide variety of programming languages (including C#, Python, and Java) through WebSocket APIs. This gives you the flexibility to build real-time cross-platform applications, and also migrate your existing WebSocket-based applications easily.

Besides the raw WebSocket support, this service also offers the json.webpubsub.azure.v1 subprotocol, which enables clients to do publish-subscribe effectively without routing data between service and backend server code. Taking the cross-platform live chatting example, the backend server code (a Web App or Function) may need to parse the client message for natural language processing, sentiment analysis, and other AI-enabled functionalities. On the other hand, action events (such as read receipt) don’t have to be routed through the Web App or Function. In this scenario, the client would send the events to targets directly through the Azure Web PubSub service using the subprotocol.

Serverless real-time applications with Azure Functions

The Azure Web PubSub service is natively integrated with Azure Functions and allows you to build serverless applications in C#, JavaScript, Python, and Java using WebSockets. Serverless solutions for real-time applications—using Azure Functions and Azure Web PubSub service—allow you to write less code, maintain less infrastructure, and save on costs. Consider a location tracking live dashboard. You can use Azure Functions to integrate and process the location data from IoT devices, and then leverage Azure Web PubSub service to broadcast the location data to multiple live dashboard clients to visualize real-time location information for your customers.

Getting started with Azure Web PubSub

To learn more about the Azure Web PubSub service, visit the Azure Web PubSub service page, and check out the preview documentation. You can get going with a free Azure account and can follow this Quickstart using the free tier or standard tier of Azure Web PubSub. The free tier is designed for dev/test so you can get started easily with one unit and create applications with up to 20 connections per unit and 20,000 messages per unit per day. Check out our code samples to showcase some real-time apps you can build with the service. We’d love to hear from you through the feedback forum and look forward to enhancing the service for your real-time web messaging needs. 

We can’t wait to see the exciting real-time apps you’ll build with the Azure Web PubSub service!