public LCLiveQueryConnection(string id) { this.id = id; responses = new Dictionary <int, TaskCompletionSource <Dictionary <string, object> > >(); heartBeat = new LCLiveQueryHeartBeat(this, OnPingTimeout); router = new LCRTMRouter(); client = new LCWebSocketClient { OnMessage = OnClientMessage, OnClose = OnClientDisconnect }; }
/// <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(); }