uni-app SSEChannel访问云函数流式响应频繁的报超时如何解
uni-app SSEChannel访问云函数流式响应频繁的报超时如何解
SSEChannel访问云函数流式响应,频繁的报超时,好像是个推的问题。不能超过5秒,有没有人遇到并解决的?
result.js? [sm]:104 Error in client code: Error: [qwen-ai-max]: ResponseTimeoutError: Response timeout for 5000ms, POST https://restapi.getui.com/v2/korfB5XFKg8hetY2XC2Oi1/push/single/cid -1 (connected: true, keepalive socket: true, agent status: {"createSocketCount":3,"createSocketErrorCount":0,"closeSocketCount":1,"errorSocketCount":0,"timeoutSocketCount":1,"requestCount":18,"freeSockets":{},"sockets":{"restapi.getui.com:443:::::::::::::::::::::":1},"requests":{}}, socketHandledRequests: 17, socketHandledResponses: 16)
更多关于uni-app SSEChannel访问云函数流式响应频繁的报超时如何解的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
可以看下这个文档,云函数超时时间设置 https://doc.dcloud.net.cn/uniCloud/cf-functions.html#packagejson
更多关于uni-app SSEChannel访问云函数流式响应频繁的报超时如何解的实战教程也可以访问 https://www.itying.com/category-93-b0.html
这个超时问题确实在uni-app SSEChannel访问云函数流式响应时比较常见。主要原因是SSE连接默认有5秒响应超时限制,而流式响应往往需要更长时间。
解决方法可以考虑以下几种:
- 调整超时时间配置: 在manifest.json中配置网络请求超时时间:
"networkTimeout": {
"request": 30000,
"connectSocket": 30000,
"uploadFile": 30000,
"downloadFile": 30000
}