- 当前 Bug 的表现(可附上截图)
osstatus -9801
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
C# socket端:
namespace WebSocketTest
{
public class Program
{
public static void Main(string[] args)
{
try
{
FleckLog.Level = LogLevel.Debug;
var allSockets = new List<IWebSocketConnection>();
var server = new WebSocketServer(“wss://0.0.0.0”);
server.ListenerSocket.NoDelay = true;
var currPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
server.Certificate = new X509Certificate2(currPath + (“MyCert.pfx”), “************”);
server.Start(socket =>
{
socket.OnOpen = () => Console.WriteLine(“Open!”); //业务内容已隐藏
socket.OnClose = () => Console.WriteLine(“Close!”);//业务内容已隐藏
socket.OnMessage = message => socket.Send(message);//业务内容已隐藏
});
var input = Console.ReadLine();
while (input != “exit”)
{
foreach (var socket in allSockets.ToList())
{
socket.Send(input);
}
input = Console.ReadLine();
}
}
catch(Exception e)
{
Console.WriteLine(e);
}
}
}
}
小程序端:
wx.connectSocket({
url: “**********”,
header: {
‘content-type’: ‘application/json’
},
});
wx.onSocketError(function(res) {
console.log(‘WebSocket连接打开失败,请检查!’+res.errMsg);
//业务逻辑已隐藏
});
报错输出log为:WebSocket连接打开失败,请检查!未能完成操作。(“OSStatus”错误-9801。)
socket报错: