更新时间:2024-07-29 GMT+08:00
安全隧道协议消息交互说明
应用端与设备端基于安全隧道协议进行消息通信的数据格式如下:
名称 |
类型 |
说明 |
---|---|---|
operation_type |
String |
数据类型。取值类型包括:
|
tunnel_service_type |
String |
隧道通信对应的业务类型,当前支持的业务类型为"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":"connect_tunnel" "tunnel_service_type": "ssh", "request_id":"xxx", "data": null }
- 平台通知应用端设备端已连接Websocket:
{ "operation_type":"command_response", "tunnel_service_type": "ssh", "request_id":"xxx", "data": "xxx" }
- 平台正常断开Websocket连接时,发送的数据:
{ "operation_type":"disconnect", "tunnel_service_type": "ssh", "request_id":"xxx", "data": { "status_code":"xxx", "status_msg":"xxx" } }