Skip to content

Commit 1afba42

Browse files
committed
Update
1 parent fbc371b commit 1afba42

File tree

8 files changed

+59
-57
lines changed

8 files changed

+59
-57
lines changed

articles/azure-web-pubsub/howto-connect-mqtt-websocket-client.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: How to Connect MQTT Clients to Azure Web PubSub
3-
description: How to Connect MQTT Clients to Azure Web PubSub
2+
title: How to connect MQTT clients to Azure Web PubSub
3+
description: How to connect MQTT clients to Azure Web PubSub
44
author: Y-Sindo
55
ms.author: zityang
66
ms.service: azure-web-pubsub
77
ms.date: 06/17/2024
88
ms.topic: how-to
99
---
1010

11-
# How To connect MQTT clients to Azure Web PubSub
11+
# How to connect MQTT clients to Azure Web PubSub
1212

1313
MQTT is a lightweight pub/sub messaging protocol designed for devices with constrained resources.
1414

@@ -28,7 +28,7 @@ If client library doesn't accept a URI, then you probably need to split the info
2828
* Port: 443
2929
* Transport: WebSockets with [TLS](https://wikipedia.org/wiki/Transport_Layer_Security).
3030

31-
[!INCLUDE [MQTT-Connection-Parameters](includes/mqtt-connection-Parameters.md)]
31+
[!INCLUDE [MQTT-Connection-parameters](includes/mqtt-connection-parameters.md)]
3232

3333
By default MQTT clients don't have any permissions to publish or subscribe to any topics. You need to grant [permissions](#permissions) to MQTT clients.
3434

@@ -45,17 +45,17 @@ A client can publish to other clients only when it's *authorized* to do so. A cl
4545
| `webpubsub.sendToGroup.<group>` | The client can publish messages to group `<group>`. |
4646
| | |
4747

48-
## Authentication and Authorization
48+
## Authentication and authorization
4949

5050
There are two workflows supported by Web PubSub to authenticate and authorize MQTT clients, so that they have proper permissions.
5151

5252
These workflows can be used individually or in combination. If they're used in together, the auth result in the latter workflow would be honored by the service.
5353

54-
### 1. JWT Workflow
54+
### 1. JWT workflow
5555

5656
This is the default workflow, shown as follows:
5757

58-
![Diagram of MQTT Auth Workflow With JWT.](./media/howto-connect-mqtt-websocket-client/mqtt-jwt-auth-workflow.png)
58+
![Diagram of MQTT auth workflow with JWT.](./media/howto-connect-mqtt-websocket-client/mqtt-jwt-auth-workflow.png)
5959

6060
1. The client negotiates with your auth server. The auth server contains the authorization middleware, which handles the client request and signs a JWT for the client to connect to the service.
6161
1. The auth server returns the JWT to the client.
@@ -131,11 +131,11 @@ You could also add custom claims into the access token, and these values are pre
131131
```
132132
---
133133

134-
### 2. Upstream Server Workflow
134+
### 2. Upstream server workflow
135135

136136
The MQTT client sends an MQTT CONNECT packet after it establishes a WebSocket connection with the service, then the service calls an API in the upstream server. The upstream server can auth the client according to the username and password fields in the MQTT connection request, and the TLS certificate from the client.
137137

138-
![Diagram of MQTT Auth Workflow With Upstream Server](./media/howto-connect-mqtt-websocket-client/mqtt-upstream-auth-workflow.png)
138+
![Diagram of MQTT auth workflow with upstream server](./media/howto-connect-mqtt-websocket-client/mqtt-upstream-auth-workflow.png)
139139

140140
This workflow needs explicit configuration.
141141
* [Tutorial - Authenticate and authorize MQTT clients based on client certificates](./tutorial-upstream-auth-mqtt-client.md)

articles/azure-web-pubsub/includes/mqtt-term-mappings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.topic: include
66
ms.date: 07/19/2024
77
---
88

9-
| MQTT Terms| Corresponding Web PubSub Terms | Relationship |
9+
| MQTT terms| Corresponding Web PubSub terms | Relationship |
1010
| --- | --- | --- |
1111
| Server/MQTT Broker | Web PubSub Service | Web PubSub service work as MQTT brokers to serve MQTT connections. Please note that we usually use the term *server* to refer to the upstream server instead of the MQTT brokers in the documents. |
1212
| Session | Connection | *Connection* in Web PubSub is a logical concept that represents a stateful relationship between the client and service, and one *Connection* is corresponding to one *Session*. Usually these two words are interchangeable. |

articles/azure-web-pubsub/overview-mqtt.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: MQTT support in Azure Web PubSub Service
2+
title: MQTT support in Azure Web PubSub service
33
description: Get an overview of Azure Web PubSub's support for the MQTT protocols, understand typical use case scenarios to use MQTT in Azure Web PubSub, and learn the key benefits of MQTT in Azure Web PubSub.
44
keywords: MQTT, MQTT on Azure Web PubSub, MQTT over WebSocket
55
author: Y-Sindo
@@ -21,57 +21,59 @@ You can use MQTT protocols in Web PubSub service for the following scenarios:
2121
> [!NOTE]
2222
> MQTT support in Azure Web PubSub is in preview stage.
2323
24-
## Key Features
24+
## Key features
2525

26-
### Standard MQTT Protocols Support
26+
### Standard MQTT protocols support
2727

2828
Web PubSub service supports MQTT 3.1.1 and 5.0 protocols in a standard way that any MQTT SDK with WebSocket transport support can connect to Web PubSub. Users who wish to use Web PubSub in a programming language that doesn't have a native Web PubSub SDK can still connect and communicate using MQTT.
2929

30-
### Cross-Protocol Communication
30+
### Cross-protocol communication
3131

3232
MQTT clients can communicate with clients of other Web PubSub protocols. Find more details [here](./reference-mqtt-cross-protocol-communication.md)
3333

34-
### Easy MQTT adoption for Current Web PubSub Users
34+
### Easy MQTT adoption for current Web PubSub users
3535

3636
Current users of Azure Web PubSub can use MQTT protocol with minimal modifications to their existing upstream servers. The Web PubSub REST API is already equipped to handle MQTT connections, simplifying the transition process.
3737

38-
### Client-to-Server Request/Response Model
38+
### Client-to-server request/response model
3939

4040
In addition to the client-to-client pub/sub model provided by the MQTT protocols, Web PubSub also support a client-to-server request/response model. Basically Web PubSub converts a specific kind of MQTT application messages into HTTP requests to registered webhooks, and sends the HTTP responses as application messages back to the MQTT clients.
4141

4242
For more details, see [MQTT custom event handler protocol](./reference-mqtt-cloud-events.md#user-custom_event-event).
4343

44-
## MQTT Feature Support Status
44+
## MQTT feature support status
45+
4546
Web PubSub support MQTT protocol version 3.1.1 and 5.0. The supported features include but not limited to:
4647

4748
* All the levels of Quality Of Service including at most once, at least once and exactly once.
4849
* Persistent session. MQTT sessions are preserved for up to 30 seconds when client connections are interrupted.
4950
* Last Will & Testament
5051
* Client Certificate Authentication
5152

52-
### Additional Features Supported For MQTT 5.0
53+
### Additional features supported for MQTT 5.0
5354

5455
* Message Expiry Interval and Session Expiry Interval
5556
* Subscription Identifier.
5657
* Assigned Client ID.
5758
* Flow Control
5859
* Server-Sent Disconnect
5960

60-
### Not Supported Feature
61+
### Not supported feature
62+
6163
* Wildcard subscription
6264
* Retained messages
6365
* Topic alias
6466
* Shared subscription
6567

66-
## How MQTT Is Adapted Into Web PubSub's System
68+
## How MQTT is adapted into Web PubSub's system
6769

6870
This section assumes you have basic knowledge about MQTT protocols and Web PubSub. You can find the definitions of MQTT terms in [MQTT V5.0.0 Spec](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901003). You can also learn basic concepts of Web PubSub in [Basic Concepts](./key-concepts.md).
6971

7072
The following table shows similar or equivalent term mappings between MQTT and Web PubSub. It helps you understand how we adapt MQTT concepts into the Web PubSub's system. It's essential if you want to use the [data-plane REST API](./reference-rest-api-data-plane.md) or [client event handlers](./howto-develop-eventhandler.md) to interact with MQTT clients.
7173

7274
[!INCLUDE [MQTT-Term-Mappings](includes/mqtt-term-mappings.md)]
7375

74-
## Client Authentication And Authorization
76+
## Client authentication and authorization
7577

7678
In general, a server to authenticate and authorize MQTT clients is required. There are two workflows supported by Web PubSub to authenticate and authorize MQTT clients.
7779

@@ -88,22 +90,23 @@ These two workflows can be used individually or in combination. If they're used
8890

8991
For details on client authentication and authorization, see [How To Connect MQTT Clients to Web PubSub](./howto-connect-mqtt-websocket-client.md).
9092

91-
## Client Lifetime Event Notification
93+
## Client lifetime event notification
9294

9395
You can register event handlers to get notification when a Web PubSub client connection is started or ended, that is, an MQTT session started or ended.
9496

9597
* [Event handler in Azure Web PubSub service](./howto-develop-eventhandler.md)
9698
* [MQTT CloudEvents Protocol](./reference-mqtt-cloud-events.md)
9799

98-
## REST API Support
100+
## REST API support
99101

100102
You can use REST API to do the following things:
103+
101104
* Publish messages to a topic, a connection, a Web PubSub user, or all the connections.
102105
* Manage client permissions and subscriptions.
103106

104107
[REST API specification for MQTT](./reference-rest-api-mqtt.md)
105108

106-
## Event Listener Support
109+
## Event listener support
107110

108111
> [!NOTE]
109112
> Sending MQTT client events to Event Hubs is not supported yet.
@@ -115,4 +118,3 @@ You can use REST API to do the following things:
115118
116119
> [!div class="nextstepaction"]
117120
> [How To Connect MQTT Clients to Web PubSub](./howto-connect-mqtt-websocket-client.md)
118-

articles/azure-web-pubsub/reference-mqtt-cloud-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Reference - CloudEvents Extension for Azure Web PubSub MQTT Event Handler with HTTP Protocol
2+
title: Reference - CloudEvents extension for Azure Web PubSub MQTT event handler with HTTP protocol
33
description: This reference describes CloudEvents extensions for the Azure Web PubSub MQTT event handler with HTTP protocol.
44
author: Y-Sindo
55
ms.author: zityang

articles/azure-web-pubsub/reference-mqtt-cross-protocol-communication.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ ms.service: azure-web-pubsub
99
ms.topic: reference
1010
---
1111

12-
# Cross-protocol Communication Between MQTT Clients and Web PubSub Clients
12+
# Cross-protocol communication between MQTT clients and Web PubSub clients
1313

1414
Sometimes you'd like to have MQTT clients and other clients using Azure Web PubSub's protocols together in one hub, enabling cross-protocol communication. This document defines how such communication works.
1515

1616
## Concepts
1717

1818
First, let's clarify the concepts in the context of cross-protocol communication.
1919

20-
* **MQTT Clients**: Clients using [MQTT](https://mqtt.org/) protocols.
21-
* **Web PubSub Clients**: Clients using Web PubSub's own protocols with pub/sub capabilities. Examples include `json.webpubsub.azure.v1`, `protobuf.webpubsub.azure.v1`, `json.reliable.webpubsub.azure.v1`, and `protobuf.reliable.webpubsub.azure.v1`. You can find an overview of Web PubSub's client protocols [here](./concept-client-protocols.md).
22-
* **Reliable Web PubSub Clients**: A subset of Web PubSub Clients using Web PubSub reliable protocols, specifically `json.reliable.webpubsub.azure.v1`, and `protobuf.reliable.webpubsub.azure.v1`.
20+
* **MQTT clients**: Clients using [MQTT](https://mqtt.org/) protocols.
21+
* **Web PubSub clients**: Clients using Web PubSub's own protocols with pub/sub capabilities. Examples include `json.webpubsub.azure.v1`, `protobuf.webpubsub.azure.v1`, `json.reliable.webpubsub.azure.v1`, and `protobuf.reliable.webpubsub.azure.v1`. You can find an overview of Web PubSub's client protocols [here](./concept-client-protocols.md).
22+
* **Reliable Web PubSub clients**: A subset of Web PubSub clients using Web PubSub reliable protocols, specifically `json.reliable.webpubsub.azure.v1`, and `protobuf.reliable.webpubsub.azure.v1`.
2323

24-
## Concept Mappings
24+
## Concept mappings
2525

26-
### Message Routing Behavior
26+
### Message routing behavior
2727

2828
From the [Overview: MQTT in Azure Web PubSub Service](./overview-mqtt.md), we learn that joining a group in Web PubSub's protocols works the same as subscribing to the same named topic in MQTT. Similarly, sending to a group means publishing to the same named topic. This means if a client using Web PubSub protocols joins group `a`, it'll' get messages from MQTT clients sending to topic `a`, and vice versa.
2929

30-
### Message Content Type Conversion
30+
### Message content type conversion
3131

3232
In Web PubSub protocols, there are four message data types: Text, Binary, JSON, and Protobuf.
3333

@@ -43,26 +43,26 @@ Here's the conversion between the MQTT "content type" field and Web PubSub messa
4343
| `application/octet-stream` | Binary |
4444
| Absent or MQTT 3.1.1 | Binary |
4545

46-
### Message Content Conversion
46+
### Message content conversion
4747

4848
For text-based Web PubSub message data types, including `Text` and `Json`, they convert to and from MQTT by UTF-8 encoding. For binary-based Web PubSub message data types, including `Protobuf` and `Binary`, they remain exactly the same in the MQTT message content.
4949

50-
### Message Quality of Service (QoS) Conversion
50+
### Message quality of service (QoS) conversion
5151

5252
In Web PubSub protocols, the QoS of a message a client receives is determined by the client's protocol. Reliable clients get only QoS 1 messages, while other clients get only QoS 0 messages.
5353

5454
In MQTT protocols, the QoS of a message a client receives is determined by both the message QoS (sending QoS) and the granted subscription QoS, specifically the smaller value of the two.
5555

5656
When messages transfer across protocols, the received QoS is defined as follows:
5757

58-
| Message Sender | Message Receiver | QoS Evaluation |
58+
| Message sender | Message receiver | QoS evaluation |
5959
|----------------|------------------|----------------|
60-
| MQTT Clients | Reliable Web PubSub Clients | QoS is always 1 |
61-
| MQTT Clients | Other Web PubSub Clients | QoS is always 0 |
62-
| Web PubSub Clients | MQTT Clients | Min(1, granted subscription QoS) |
60+
| MQTT clients | Reliable Web PubSub clients | QoS is always 1 |
61+
| MQTT clients | Other Web PubSub clients | QoS is always 0 |
62+
| Web PubSub clients | MQTT clients | Min(1, granted subscription QoS) |
6363

6464
### Others
6565

6666
Message properties listed here take effect across protocols. The others don't.
6767

68-
* MQTT Message expiry interval
68+
* MQTT message expiry interval

articles/azure-web-pubsub/reference-rest-api-mqtt.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Azure Web PubSub service data plane REST API Specification for MQTT
2+
title: Azure Web PubSub service data plane REST API specification for MQTT
33
description: Clarifies the meanings of the Web PubSub data-plane REST API in the context of MQTT
44
author: Y-Sindo
55
ms.author: zityang
@@ -12,27 +12,27 @@ ms.date: 07/23/2024
1212

1313
This document clarifies the meanings of the Web PubSub data-plane REST API in the context of MQTT. The existing Web PubSub REST API documentation is focused on Web PubSub’s own protocols, which may make its application to MQTT unclear.
1414

15-
## Term Mappings
15+
## Term mappings
1616

1717
To begin, familiarize yourself with the term mappings between Web PubSub and MQTT. If you are already familiar with these terms, you may skip this section.
1818

1919
[!INCLUDE [MQTT-Term-Mappings](includes/mqtt-term-mappings.md)]
2020

21-
## Operation Mappings
21+
## Operation mappings
2222

2323
For a comprehensive list of available operations, refer to the [REST API reference](/rest/api/webpubsub/dataplane/web-pub-sub).
2424

2525
The REST API operations are categorized into the following groups:
2626

27-
* [Message Sending Operations](#message-sending-operations)
28-
* [Subscription Management Operations](#subscription-management-operations)
29-
* [Permission Management Operations](#permission-management-operations)
30-
* [Existence Management Operations](#existence-management-operations)
31-
* [Client Token Generation Operations](#client-token-generation-operations)
27+
* [Message sending operations](#message-sending-operations)
28+
* [Subscription management operations](#subscription-management-operations)
29+
* [Permission management operations](#permission-management-operations)
30+
* [Existence management operations](#existence-management-operations)
31+
* [Client token generation operations](#client-token-generation-operations)
3232

3333
Each of these categories is defined below.
3434

35-
### Message Sending Operations
35+
### Message sending operations
3636

3737
| REST API Operation | Effect on MQTT |
3838
| ------------------ | -------------- |
@@ -41,7 +41,7 @@ Each of these categories is defined below.
4141

4242
Messages are published with a QoS of 1. The QoS of received messages may be downgraded based on the clients' subscription options, following the standard MQTT downgrading rules.
4343

44-
### Subscription Management Operations
44+
### Subscription management operations
4545

4646
| REST API Operation | Effect on MQTT |
4747
| ------------------ | -------------- |
@@ -51,21 +51,21 @@ Messages are published with a QoS of 1. The QoS of received messages may be down
5151

5252
The group name corresponds to the MQTT topic filter. When adding connections or users to groups, default MQTT subscription options are used.
5353

54-
### Permission Management Operations
54+
### Permission management operations
5555

5656
These operations are straightforward in the context of MQTT and thus the definition is ignored.
5757
* Check Permission
5858
* Grant Permission
5959
* Revoke Permission
6060

61-
### Existence Management Operations
61+
### Existence management operations
6262

6363
| REST API Operation | Effect on MQTT |
6464
| ------------------ | -------------- |
6565
| Connection Exists<br>Group Exists<br>User Exists | Checks whether a session exists for the specified connection, user, or group. Note that this differs from checking if a connection is currently online. |
6666
| Close All Connections<br>Close Group Connections<br>Close User Connections | Ends the specified sessions and terminates the corresponding physical connections. |
6767

68-
### Client Token Generation Operations
68+
### Client token generation operations
6969

7070
| REST API Operation | Effect on MQTT |
7171
| ------------------ | -------------- |

articles/azure-web-pubsub/tutorial-upstream-auth-mqtt-client.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ In this tutorial, you'll learn how to write a .NET web server to authenticate an
2020
* [.NET Runtime](https://dotnet.microsoft.com/download/dotnet) installed.
2121
* [Node.js](https://nodejs.org)
2222

23-
## Deploy Azure Web PubSub Service
23+
## Deploy Azure Web PubSub service
2424

2525
Here are the Bicep/Azure Resource Manager templates to deploy an Azure Web PubSub service with client certificate authentication enabled and event handlers configured.
2626

@@ -139,7 +139,7 @@ resource hub 'Microsoft.SignalRService/WebPubSub/hubs@2023-03-01-preview' = {
139139

140140
---
141141

142-
## Set Up Auth Server
142+
## Set up auth server
143143

144144
We've provided an auth server sample [here](https://github.com/Azure/azure-webpubsub/tree/main/samples/csharp/mqttAuthServer). Please download the project.
145145

@@ -193,7 +193,7 @@ dotnet run
193193
```
194194

195195

196-
### Expose Server Endpoint To Public Network
196+
### Expose server endpoint to public network
197197

198198
#### Download and install awps-tunnel
199199
The tool runs on [Node.js](https://nodejs.org/) version 16 or higher.
@@ -208,7 +208,7 @@ export WebPubSubConnectionString="<your connection string>"
208208
awps-tunnel run --hub {hubName} --upstream http://localhost:{portExposedByYourAuthServer}
209209
```
210210

211-
## Implement MQTT Clients
211+
## Implement MQTT clients
212212

213213
We will implement the client side in Node.JS.
214214

0 commit comments

Comments
 (0)