예제 #1
0
 /// <summary>
 /// Closes the connection.
 /// </summary>
 /// <returns></returns>
 internal async Task Close()
 {
     OnNotification = null;
     OnDisconnect   = null;
     OnReconnected  = null;
     heartBeat.Stop();
     await client.Close();
 }
예제 #2
0
        /// <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();
        }