Exemple #1
0
        /// <summary>
        /// Tests the connection to the given target-proxy object
        /// </summary>
        /// <returns>a value indicating whether the connection is OK</returns>
        protected override bool Test()
        {
            if (connected || !initCalled)
            {
                if (!connection.Initialized)
                {
                    try
                    {
                        connection.Initialize();
                        if (isBidirectional != IsBidirectional)
                        {
                            throw new Exception("Failed to Register return-channel. Check permissions on server.");
                        }
                    }
                    finally
                    {
                        initCalled = true;
                    }
                }

                if (!connection.Operational)
                {
                    ConnectivityChanged(null, null);
                    return(connected = false);
                }

                return(connected = connection.DiscoverService(targetService));
            }
            else
            {
                try
                {
                    ReConnectClient();
                    //return Test();
                }
                catch
                {
                    connection?.Dispose();
                    connection = null;
                    connected  = false;
                }
            }

            return(false);
        }
Exemple #2
0
 /// <summary>
 /// Invokes a test-method on the event-subscribing client
 /// </summary>
 /// <param name="sessionId">the session id for which to check whether the client is still present</param>
 /// <returns>a value indicating whether the client is still active</returns>
 protected override bool Test(string sessionId)
 {
     return(hubClient.DiscoverService(sessionId));
 }