diff --git a/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/StsAgent.kt b/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/StsAgent.kt index ad533c229..97fe12eda 100644 --- a/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/StsAgent.kt +++ b/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/StsAgent.kt @@ -638,12 +638,14 @@ class StsAgent( "?deviceNo=${config.deviceNo}&deviceId=${config.deviceId}" + "&productId=${config.productId}&productKey=${config.productKey}" + "&sign=$sign&sn=$sn&ts=$ts" - Log.i(TAG, "[YIDONG] connectWs: 连接WSS deviceNo=${config.deviceNo} deviceId=${config.deviceId} sn=$sn") + Log.i(TAG, "[YIDONG] connectWs: 连接WSS deviceNo=${config.deviceNo} deviceId=${config.deviceId} sn=$sn ts=$ts sign=$sign") + Log.i(TAG, "[YIDONG] connectWs: 完整URL = $url") val req = Request.Builder().url(url) .header("Origin", "https://ivs.chinamobiledevice.com:11443") .header("Host", "ivs.chinamobiledevice.com:11443") .build() + Log.i(TAG, "[YIDONG] connectWs: 请求头 Origin=https://ivs.chinamobiledevice.com:11443 Host=ivs.chinamobiledevice.com:11443") var resolved = false @@ -667,7 +669,17 @@ class StsAgent( override fun onMessage(ws: WebSocket, bytes: okio.ByteString) {} override fun onFailure(ws: WebSocket, t: Throwable, response: Response?) { - Log.e(TAG, "[YIDONG] connectWs: WSS连接失败 ${t.message}") + val respInfo = if (response != null) { + val bodySnippet = try { + response.peekBody(2048).string() + } catch (e: Exception) { "" } + "code=${response.code} message=${response.message} headers=${response.headers} body=$bodySnippet" + } else { + "" + } + Log.e(TAG, "[YIDONG] connectWs: WSS连接失败 exception=${t.javaClass.name} message=${t.message}") + Log.e(TAG, "[YIDONG] connectWs: WSS连接失败 response: $respInfo") + Log.e(TAG, "[YIDONG] connectWs: WSS连接失败 url=$url") if (webSocket === ws) webSocket = null // 只清除自己的引用,避免覆盖新 WS if (!resolved) { resolved = true; cont.resumeWithException(t) } else launch { handleWsDone() }