There is a configuration option to tell the SignalR JS client to wait for the page load event to complete before sending anything.
Just set waitForPageLoad: false in the startup options to prevent this from happening. Of course, you must make sure that everything you do in the callback can be safely executed if the page is not loaded.
Any video that does not load can delay the start - so I'm not sure why this is not better / more widely documented!
$.connection.hub.start({ waitForPageLoad: false}).done(function() { });
Excerpt from the source code (this is how I discovered it):
// Check to see if start is being called prior to page load // If waitForPageLoad is true we then want to re-direct function call to the window load event if (!_pageLoaded && config.waitForPageLoad === true) { connection._.deferredStartHandler = function () { connection.start(options, callback); }; _pageWindow.bind("load", connection._.deferredStartHandler); return deferred.promise(); }
Simon_Weaver
source share