Skip to content

Latest commit

 

History

History
74 lines (51 loc) · 3.65 KB

reference-rest-api-mqtt.md

File metadata and controls

74 lines (51 loc) · 3.65 KB
titledescriptionauthorms.authorms.servicems.topicms.date
Azure Web PubSub service data plane REST API specification for MQTT
Clarifies the meanings of the Web PubSub data-plane REST API in the context of MQTT
Y-Sindo
zityang
azure-web-pubsub
reference
07/23/2024

REST API specification for MQTT

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.

Term mappings

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.

[!INCLUDE MQTT-Term-Mappings]

Operation mappings

For a comprehensive list of available operations, refer to the REST API reference.

The REST API operations are categorized into the following groups:

Each of these categories is defined below.

Message sending operations

REST API OperationEffect on MQTT
Send to GroupMQTT connections subscribed to the topic named with the group name will receive the message.
Send to All
Send to User
Send to Connection
The respective MQTT connections will receive a message with the topic $webpubsub/server/messages.

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.

Subscription management operations

REST API OperationEffect on MQTT
Add Connections to Groups
Add Connection to Group
Adds a subscription for the specified connections.
Add User to GroupAdds a subscription for all connections of the specified user.
Remove Connection from All Groups
Remove Connection from Group
Remove Connections from Groups
Remove User from All Groups
Remove User from Group
Removes one or all subscriptions for the specified connections or users.

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

Permission management operations

These operations are straightforward in the context of MQTT and thus the definition is ignored.

  • Check Permission
  • Grant Permission
  • Revoke Permission

Existence management operations

REST API OperationEffect on MQTT
Connection Exists
Group Exists
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.
Close All Connections
Close Group Connections
Close User Connections
Ends the specified sessions and terminates the corresponding physical connections.

Client token generation operations

REST API OperationEffect on MQTT
Generate Client TokenGenerates the connection token and URL for MQTT clients to connect.

Please note that MQTT support is available starting from REST API version 2024-01-01. You must specify the query parameter clientType=MQTT for MQTT clients.

close