Search code examples
javascriptcallbacksignalrblock

SignalR Connection Blocked Until page images load


this is my signalr hub connection :

  chat = $.connection.chat;
  $.connection.hub.start().done(function () {
     // problem is here 
     // this part is waiting for full page load.!
  });

I have a <img src='BAD SERVER'/>sometimes take one minute to load successfully. and the connection won't start until the images completely loads.

How can I make signalR to start before the page load completes?


Solution

  • Try this:

    chat = $.connection.chat;
    $.connection.hub.start({ waitForPageLoad: false }).done(function () {
     // problem is here 
     // this part is waiting for full page load.!
    });