The IoT Hub platform supports MQTT communication based on WebSocket, so that devices can use the MQTT protocol for message transfer on the basis of the WebSocket protocol. In this way, browser-based applications can implement data communication with the platform and devices connected to the platform. In addition, WebSocket uses ports 443/80, which means that messages can pass through most firewalls during transfer.
As both the MQTT-WebSocket and MQTT-TCP protocols ultimately transfer messages based on MQTT, they have the same parameters for MQTT connection. The main difference lies in the protocol and port of the MQTT connection to the platform. Key-authenticated devices use WS for connection, while certificate-authenticated devices use WSS, i.e., WS+TLS.
${ProductId}.ap-guangzhou.iothub.tencentdevices.com:443
, where ${ProductId}
is the product ID.UserName:${productid}${devicename};${sdkappid};${connid};${expiry}
PassWord: password (you can set any value)
ClientId:${ProductId}${DeviceName}
KeepAlive: time to keep the connection alive. Value range: 0–900s
${ProductId}.ap-guangzhou.iothub.tencentdevices.com:80
, where ${ProductId}
is the product ID.UserName:${productid}${devicename};${sdkappid};${connid};${expiry}
PassWord:${token};hmac signature algorithm
ClientId:${ProductId}${DeviceName}
KeepAlive: time to keep the connection alive. Value range: 0–900s
Was this page helpful?