fix: OpenClaw 连接改为主动发送 connect 请求
- 连接 WebSocket 后立即主动发送 connect 请求 - 兼容不发送 challenge 的服务器配置 - 保留 challenge 响应逻辑作为备用 - 添加更详细的连接日志
This commit is contained in:
@@ -343,14 +343,16 @@ class OpenClawConnection {
|
|||||||
this.socket.on('open', () => {
|
this.socket.on('open', () => {
|
||||||
this.isConnected = true;
|
this.isConnected = true;
|
||||||
this.reconnectAttempts = 0;
|
this.reconnectAttempts = 0;
|
||||||
console.log('[OpenClaw] WebSocket connected, waiting for challenge...');
|
console.log('[OpenClaw] WebSocket connected');
|
||||||
|
|
||||||
// 检查窗口是否存在
|
// 检查窗口是否存在
|
||||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||||
this.eventHandler('connected');
|
this.eventHandler('connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注意:不立即发送 connect,等待服务器发送 connect.challenge 后再响应
|
// 主动发送 connect 请求(兼容模式:不等待 challenge)
|
||||||
|
console.log('[OpenClaw] Sending connect request...');
|
||||||
|
this.sendConnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.socket.on('message', (data) => {
|
this.socket.on('message', (data) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user