The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

Heartbeat

Last updated: 2026-04-03 17:48:39

1. API Description

API request domain name: wss://iot.cloud.tencent.com/iotstudio_v2_weapp_1 Device keep-alive. Update the device timestamp through this API to maintain the device's listening status and keep the WebSocket connection simultaneous. Multiple calls are allowed, once every 60 seconds.

2. Input Parameters

Name
Type
Required
Description
action
String
Yes
Common parameter, this interface takes values: YunApi.
reqId
String
Yes
Common parameter, indicating the request sequence, unique request ID, can be generated manually.
params
Object
Yes
For the detailed parameters passed in when calling the api, please see YunApiParam.

3. Output Parameters

Name
Type
Description
reqId
String
Common parameter, indicating the request sequence, same as the input parameter.
error
String
status code, being empty indicates correct.
error_message
String
Detailed error description, being empty indicates correct.
data
Object
For the server response of the Heartbeat API, please see HeartBeatData.

4. Samples

Input example (Convert data to json string before sending)
const ws = new WebSocket("wss://iot.cloud.tencent.com/iotstudio_v2_weapp_1")

ws.send(JSON.stringify({
"action":"YunApi",
"reqId":"req0001",
"params":{
"Action": "AppDeviceTraceHeartBeat",
"ActionParams": {
"DeviceIds": ["product ID/device name", "product ID/device name"]
"AccessToken": "f6******************3aad",
"RequestId":"rest-client"
}
}
}))
Output sample: successful
{
"error":"",
"error_message":"",
"data":{
"Response": {
"RequestId":"rest-client"
}
},
"reqId":"req0001"
}
Output sample: failure (server error)
{
"error":"-1",
"error_message":"Error connecting with backend, contact the admin"
"data":{},
"reqId":"req0001"
}
Output sample: failure (logic error)
{
"error":"",
"error_message":"",
"data":{
"Response": {
"Error":{
"Code": "UnauthorizedOperation.APPNoPermissionToStudioProduct",
"Message": "App has no permission to perform operations on this product"
},
"RequestId":"rest-client"
}
},
"reqId":"req0001"
}