WebSocket 权限范围
WebSocket 使用 API Client 权限。创建 ticket 和执行请求时,服务会验证客户端、应用、账号和设备当前状态。
| 请求 | 所需权限 |
|---|---|
session.ping | 已认证连接 |
device.state.get | device:read |
device.operation.execute + device.relay.set | device:control |
device.operation.execute + device.rs485.transceive | device:control |
device.operation.execute + device.rs485.baudRate.set | device:config |
device.operation.execute + device.relay.jogConfig.set | device:config |
权限不足时返回:
json
{
"type": "reply",
"requestId": "req_relay_001",
"code": "AUTH_SCOPE_DENIED",
"message": "This operation requires the device:control permission. Update the API Client permissions in the Developer Console and obtain a new access token.",
"data": {
"requiredScope": "device:control"
}
}修改 API Client 权限后,应重新获取 access token,再创建新的 WebSocket ticket。不要继续使用修改权限前签发的 token。
