remote control

Remote Control 允许从远程客户端控制 Claude Code 实例。

使用场景

  • Web 界面控制终端实例

  • IDE 插件集成

  • 移动端访问

  • 团队协作

传输方式

WebSocket

双向实时通信:

const ws = new WebSocket('ws://localhost:3000');

ws.on('open', () => {
  ws.send(JSON.stringify({
    type: 'query',
    messages: [{ role: 'user', content: 'Hello' }],
  }));
});

ws.on('message', data => {
  const event = JSON.parse(data);
  console.log(event);
});

Server-Sent Events (SSE)

单向流式通信:

安全措施

HTTPS/WSS

生产环境必须使用加密连接:

访问控制

下一步

  • 查看 Bridge 模式 的完整实现

  • 了解 Assistant 模式

  • 探索 Coordinator 模式