Closed cyanray closed 2 years ago
关于处理 WebSocket 掉线问题,#17 ,提供一个我目前正在使用的方案。
使用者可以通过订阅 DisconnectionHappened 处理 WebSocketClient 掉线事件。
修改后的使用方法:
var connect = async () => { while (true) { try { Console.WriteLine("尝试建立连接..."); await bot.LaunchAsync(); Console.WriteLine("Bot working..."); break; } catch (Exception ex) { Console.WriteLine(ex.Message); } } }; // 与 mah 建立连接 await connect(); // 处理失去连接事件 bot.DisconnectionHappened .Subscribe(async status => { Console.WriteLine($"失去连接:{status}"); await connect(); });
关于处理 WebSocket 掉线问题,#17 ,提供一个我目前正在使用的方案。
使用者可以通过订阅 DisconnectionHappened 处理 WebSocketClient 掉线事件。
修改后的使用方法: