/// <summary> /// Closes the connection. /// </summary> /// <returns></returns> internal async Task Close() { OnNotification = null; OnDisconnect = null; OnReconnected = null; heartBeat.Stop(); await client.Close(); }
/// <summary> /// Resets connection /// </summary> /// <returns></returns> internal async Task Reset() { heartBeat?.Stop(); // 关闭就连接 await client.Close(); // 重新创建连接组件 heartBeat = new LCLiveQueryHeartBeat(this, OnPingTimeout); router = new LCRTMRouter(); client = new LCWebSocketClient { OnMessage = OnClientMessage, OnClose = OnClientDisconnect }; await Reconnect(); }