Blog Post

Apps on Azure Blog
3 MIN READ

Announcing MQTT Support in Azure Web PubSub Service (public preview)

kevinguo's avatar
kevinguo
Icon for Microsoft rankMicrosoft
Aug 21, 2024

We are excited to introduce the highly anticipated MQTT support in Azure Web PubSub, now available in preview! 

 

With this new feature, web applications that communicate using MQTT over WebSocket can seamlessly connect to Azure Web PubSub to publish and receive messages. The service recognizes and translates MQTT messages into its native protocol, enabling cross-communication between MQTT web clients and other Web PubSub clients. This new capability addresses two key use cases: 

Real-time Applications With Mixed Protocols: You can allow clients using different real-time protocols to exchange data through the Azure Web PubSub service. 

Support For Additional Programming Languages: You can use any MQTT library to connect with the service, making it possible to integrate with applications written in languages like C++, beyond the existing SDKs in C#, JavaScript, Python, and Java. 

 

It’s important to note that this MQTT integration is a lightweight adaptation of the MQTT protocol and extends only to the features already supported by Azure Web PubSub. Some MQTT features that are not supported include: 

  • Wildcard subscriptions 
  • Retained messages 
  • Shared subscriptions 

 

For a more comprehensive MQTT broker solution on Azure, we recommend exploring Azure Event Grid. 

 

Enhancing Azure Web PubSub with MQTT

Modern users expect real-time experiences from their web applications. Data must be delivered to them as soon as it is available. Take, for example, a stock market app: when stock prices change, users want those updates in real-time. Failing to provide this can result in poor user engagement. 

 

Before WebSocket became widely available in browsers, developers relied on techniques like polling, which created performance challenges as they scaled. Azure Web PubSub, built on top of WebSocket, resolves these issues, offering developers a fast, scalable way to build real-time web applications. 

 

With the introduction of MQTT support, Azure Web PubSub bridges the gap between the MQTT protocol and its native protocols. This allows developers to integrate MQTT web clients with minimal changes to their codebases, maintaining smooth, real-time communication between systems. 

 

MQTT web clients can now communicate with other Azure Web PubSub-supported clients, such as WebSocket clients using custom subprotocols. This is particularly useful in scenarios where data from MQTT-based sources needs to be presented in real-time in web applications. 

 

Key features of MQTT in Azure Web PubSub 

MQTT 3.1.1 and 5.0 Protocol Support: Azure Web PubSub supports these versions of MQTT, enabling any MQTT client library with WebSocket transport to connect. This ensures flexibility, regardless of your platform or programming language. As mentioned above, there're a few MQTT features that are not supported by Azure Web PubSub - they are

  • Wildcard subscriptions 
  • Retained messages 
  • Shared subscriptions 

Cross-Protocol Communication: MQTT web clients can interact with clients using other Web PubSub protocols. This expands integration possibilities, enabling communication across diverse systems within a single communication hub. 

Seamless Integration for Existing Web PubSub Users: Existing Azure Web PubSub customers can adopt MQTT with minimal modifications, as the Web PubSub REST API is equipped to handle MQTT connections. 

 

Get started today! 

We’re thrilled to offer MQTT support in Azure Web PubSub and are eager to see how developers will leverage this feature in their projects. To get started quickly, check out Azure Web PubSub’s documentation and tutorials. 

Updated Oct 17, 2024
Version 7.0
No CommentsBe the first to comment