WebSocket API

OpenVort WebSocket 实时通信协议文档

WebSocket API

连接

ws://{host}/api/ws?token={jwt_token}

通过 query parameter 传递 JWT Token 进行认证。

客户端 → 服务端

ping

{ "type": "ping" }

响应:{ "type": "pong", "ts": 1234567890 }

typing

{ "type": "typing", "is_typing": true }

广播给其他在线用户。

服务端 → 客户端

unread_update

{
  "type": "unread_update",
  "session_id": "abc123",
  "count": 3
}

task_status

{
  "type": "task_status",
  "member_id": "member_001",
  "status": "executing",
  "job_name": "日报生成"
}

schedule_result

{
  "type": "schedule_result",
  "job_id": "sched_001",
  "job_name": "日报生成",
  "result": "...",
  "executor_name": "Mac Mini 01",
  "severity": "info",
  "actions": [
    { "label": "重新执行", "action": "rerun", "job_id": "sched_001" }
  ]
}

offline_summary

{
  "type": "offline_summary",
  "unreads": 5,
  "highlights": ["Mac Mini 01 完成了日报生成", "..."]
}

node_status_change

{
  "type": "node_status_change",
  "node_id": "node_001",
  "status": "online",
  "old_status": "offline"
}

presence

{
  "type": "presence",
  "online": [
    { "member_id": "m001", "name": "张三" }
  ]
}