/// <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();
        }
Exemple #2
0
 private void Disconnect()
 {
     defaultClientId = null;
     state           = State.Closed;
     heartBeat.Stop();
     _ = ws.Close();
     foreach (LCIMClient client in idToClients.Values)
     {
         client.HandleDisconnected();
     }
 }