使用 uniapp 开发的程序:
在PC端,能正常进行 wss//xny.world:18283/ws 的连接建立,消息的发送与接收都是正常的,运行到 “微信开发者工具”中 无法访问,真机调试 也是不行。报错:
[worker] reportRealtimeAction:fail not support
WebSocket connection to 'wss://xny.world:18283/ws/' failed: WebSocket is closed before the connection is established.
可是无法实现访问。
请帮忙指导一下,在用uniapp 开发程序,使用 wss(websocket),运行到微信小程序上,有哪些区别及需要注意些什么?谢谢
找到原因了:将最末尾的 "/" 斜杆 去了,就可以。wss://xny.world:18283/ws/ 改为 wss://xny.world:18283/ws。
这得算 微信小程序的一个bug。
你没搞错吧,难道配上域名,你代码怎么写服务怎么部署就能ok了?
[wxapplib]] Uncaught (in promise) FrameworkError {“errno”:101,“errMsg”:“private_getBackgroundFetchData:fail private_getBackgroundFetchData:fail:jsapi invalid request data”}
[wxapplib]] Uncaught (in promise) FrameworkError {“errMsg”:“closeSocket:fail:The code must be either 1000, or between 3000 and 4999”}
见多识广的朋友,请帮忙分析一下!
不用uniapp呢?能不能用小程序无法写个代码片段
AppID:wx10dd6c67bc7c45cb
[worker] reportRealtimeAction:fail not support
WebSocket connection to 'wss://xny.world:18283/ws/' failed: WebSocket is closed before the connection is established.
请帮忙分析一下