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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -