更新时间:2024-11-26 GMT+08:00
安全隧道协议消息交互说明
当应用端与设备端建立安全隧道的WebSocket连接后,应用端与设备端将基于安全隧道协议进行消息通信,数据格式如下:
|
名称 |
类型 |
说明 |
|---|---|---|
|
operation_type |
String |
参数说明: 数据类型。 取值范围:
|
|
tunnel_service_type |
String |
参数说明: 隧道通信对应的业务类型。 取值范围: ssh。当前支持的业务类型为"ssh"。 |
|
request_id |
String |
参数说明: 不同数据类型的会话ID。 约束限制: 在当前安全隧道内唯一。 |
|
data |
Object |
参数说明: 传输数据内容。 |
示例
- 平台通知应用端设备已连接Websocket:
{
"operation_type":"connect_tunnel"
"tunnel_service_type": "ssh",
"request_id":"xxx",
"data": null
}
- 应用端下发ssh通道连接参数给设备:
{
"operation_type": "connect",
"tunnel_service_type": "ssh",
"request_id":"xxx",
"data": {
"username":"xxx",
"password": ""
}
}
- 设备端上报连接响应给应用端:
{
"operation_type":"connect_response"
"tunnel_service_type": "ssh",
"request_id":"xxx",
"data": "xx"
}
- 应用端下发ssh命令给设备:
{
"operation_type":"command",
"tunnel_service_type": "ssh",
"request_id":"xxx",
"data": "xxx"
}
- 设备端上报ssh命令执行响应给应用端:
{
"operation_type":"command_response"
"tunnel_service_type": "ssh",
"request_id":"xxx",
"data": null
}
- 平台正常断开Websocket连接时,发送数据给应用端:
{
"operation_type":"disconnect",
"tunnel_service_type": "ssh",
"request_id":"xxx",
"data": {
"status_code":"xxx",
"status_msg":"xxx"
}
}
父主题: 安全隧道WebSocket接口参考