ebram khalil
ebram khalil

Reputation: 8321

SignalR take long time while execution on chrome

i have developed a simple web application using SignalR just to get idea about how to use it. The Class i used ::

public class HealthCheck : Hub
{
    public static List<string> messages = new List<string>();
    public void GetServiceState()
    {
        Clients.updateMessages(messages);
    }
    public void UpdateServiceState()
    {
        messages.Add(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));            
        Clients.updateMessages(messages);
    }
}

then the web page i used ::

<script type="text/javascript">
    $(function () {
        // creates a proxy to the health check hub
        var healthCheckHub = $.connection.healthCheck;
        // handles the callback sent from the server
        healthCheckHub.updateMessages = function (data) {                
            $("li").remove();
            $.each(data, function () {
                $('#messages').append('<li>' + this + '</li>');
            });
        };
        $("#trigger").click(function () {
            healthCheckHub.updateServiceState();
        });
        // Start the connection and request current state
        $.connection.hub.start(function () {
            healthCheckHub.getServiceState();
        });
    });
</script>
<ul id="messages">
</ul>
<button type="button" id="trigger">
    Send request</button>

All my problem is that when i click the button it takes a long time about 40 sec or 1 min so that i see the results...

on FF or IE9 i get the results so quick.

So is that a problem in my code or in signalR or Browser. i'm using SignalR V 0.5.3

Thanks for your help.

Upvotes: 2

Views: 1389

Answers (1)

ebram khalil
ebram khalil

Reputation: 8321

Finally i found the problem...

The source of my problem on chrome was because of my antivirus.

i'm using AVG internet security 2013. All i need to do is to disable 'Online Shield'.

for details i found the solution here :: Connect Pending in Chrome

Upvotes: 3

Related Questions