概述
We developed an iOS application and configured the app to listen to all the messages published on a particular MQTT topic on AWS IoT.
All I want to know is, is there a way where I can pull a list of connected devices who are listening on that topic ? (I checked the cloudWatch logs and I couldn't find the detailed info like the MAC address of the device connected etc).
Also, I want to know if there is limit on the no. of devices that can be subscribed to a topic.
解决方案
There is no limit to the number of devices on a single topic. One of the major pros for the service - it scales virtually infinitely. Here's a full list of all the AWS IoT Limits.
There's no easy way to query the number of devices connected directly from AWS IoT. But there is a way to detect when any device subscribes and unsubscribes from a topic using the message data from AWS Reserved Topics - specifically these topics below:
$aws/events/subscriptions/subscribed/{clientId}
$aws/events/subscriptions/unsubscribed/{clientId}
You could create an IoT rule to forward all subscribed and unsubscribed events from those reserved topics to S3, DynamoDB or RDS to be queryable. A simple Lambda function to increment on subscribes and decrement on unsubscribes within DynamoDB would work really well too. (DynamoDB Atomic Counter)
Also here's what the message body looks like - from Subscribe/Unsubscribe Events:
{
"clientId": "186b5",
"timestamp": 1460065214626,
"eventType": "subscribed" | "unsubscribed",
"sessionIdentifier": "00000000-0000-0000-0000-000000000000",
"principalIdentifier": "000000000000/ABCDEFGHIJKLMNOPQRSTU:some-user/ABCDEFGHIJKLMNOPQRSTU:some-user"
"topics" : ["foo/bar","device/data","dog/cat"]
}
最后
以上就是可靠手套为你收集整理的aws iot 连接时间,连接到AWS IoT MQTT主题的客户端数量的全部内容,希望文章能够帮你解决aws iot 连接时间,连接到AWS IoT MQTT主题的客户端数量所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复