Uncaught (in promise) FrameworkError Object { errMsg: "closeSocket:fail taskID not exist" } e@https://res.servicewechat.com/weapp/debug/***************/1/:27576:36669 value@https://res.servicewechat.com/weapp/debug/***************/1/:27576:32222 https://res.servicewechat.com/weapp/debug/***************/1/:27576:16387 https://res.servicewechat.com/weapp/debug/***************/1/:27576:19197 forEach@[native code] https://res.servicewechat.com/weapp/debug/***************/1/:27576:19087
你可以试试GoEasy提供的websocket服务,对微信小程序和小游戏的支持都很好,支持wss、websocket心跳、重连机制,我们基于GoEasy的互动小游戏目前上线运营一段时间了,效果很好,稳定性比我们自己做的好多了。地址:https://www.goeasy.io
我使用官方的小游戏API调用示例(https://github.com/wechat-miniprogram/minigame-demo),没有复现你的报错,但是websocket连接后如果切入后台一段时间是会自动断开,在切回来后需要你手动重连。我测试的机子是iPhone11