SignalR is slow to connect from javascript client -
it takes second or more connect signalr server browser - when running locally. thought websockets supposd fast!
there configuration option tell signalr js client wait until page load
event complete before sending anything.
just set waitforpageload: false
in startup options prevent happening. of course must make sure in callback can executed safely if page isn't loaded.
anything youtube video not loading can delay start - i'm not sure why isn't better/more documented!
$.connection.hub.start({ waitforpageload: false}).done(function() { });
excerpt source code (which how discovered this):
// check see if start being called prior page load // if waitforpageload true want re-direct function call window load event if (!_pageloaded && config.waitforpageload === true) { connection._.deferredstarthandler = function () { connection.start(options, callback); }; _pagewindow.bind("load", connection._.deferredstarthandler); return deferred.promise(); }
Comments
Post a Comment