You can call this operation to query the number of connected Message Queue for MQTT (MQTT) clients in a group based on the specified group ID.
Scenarios
OnsMqttQueryClientByGroupId is typically used for service analysis and used to query statistics on the activity level of the devices that correspond to the specified group ID.
API operations are designed for you to implement custom management and development. Based on this, the MQTT broker throttles frequent calls that amount to 30 or more per minute. Therefore, do not call this operation in the main service process.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsMqttQueryClientByGroupId |
The operation that you want to perform. Set the value to OnsMqttQueryClientByGroupId. |
GroupId | String | Yes | GID_test |
The group ID that you want to query. |
InstanceId | String | No | post-cn-0pp12gl**** |
The ID of the MQTT instance to which the group ID you want to query belongs. This parameter is required for instances with separate namespaces. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
MqttClientSetDo |
The structure of information about whether the MQTT clients in the group were connected. |
||
OnlineCount | Long | 1 |
The total number of connected MQTT clients in the group. |
RequestId | String | E54CBFC3-7700-44BC-8FFA-B61E471D4876 |
The ID of the request, which is a common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating. |
Examples
Sample request
http(s)://[Endpoint]/? Action=OnsMqttQueryClientByGroupId
&GroupId=GID_test
&InstanceId=post-cn-0pp12gl****
&<Common request parameters>
Sample success response
XML
format
<OnsMqttQueryClientByGroupIdResponse>
<RequestId>E54CBFC3-7700-44BC-8FFA-B61E471D4876</RequestId>
<MqttClientSetDo>
<OnlineCount>1</OnlineCount>
</MqttClientSetDo>
</OnsMqttQueryClientByGroupIdResponse>
JSON
format
{
"RequestId":"E54CBFC3-7700-44BC-8FFA-B61E471D4876",
"MqttClientSetDo":{
"OnlineCount":1
}
}
Error codes
For a list of error codes, visit the API Error Center.