Skip to content

Instantly share code, notes, and snippets.

@lpinca
Created March 26, 2014 08:57
Show Gist options
  • Save lpinca/9779145 to your computer and use it in GitHub Desktop.
Save lpinca/9779145 to your computer and use it in GitHub Desktop.
Required time for a connection to be established (IE8 + SockJS + jsonp-polling)
--- sockjs-0.3.4.js 2014-03-26 09:49:46.000000000 +0100
+++ sockjs-0.3.4-m.js 2014-03-26 09:55:07.000000000 +0100
@@ -933,6 +933,8 @@
* ***** END LICENSE BLOCK *****
*/
+var timestamp;
+
var SockJS = function(url, dep_protocols_whitelist, options) {
if (this === _window) {
// makes `new` optional
@@ -1009,6 +1011,7 @@
clearTimeout(that._transport_tref);
that._transport_tref = null;
}
+ console.log(new Date().getTime() - timestamp);
that.readyState = SockJS.OPEN;
that.dispatchEvent(new SimpleEvent("open"));
} else {
@@ -1147,6 +1150,7 @@
var trans_url = that._base_url + '/' + that._server + '/' + connid;
that._debug('Opening transport:', protocol, ' url:'+trans_url,
' RTO:'+that._options.rto);
+ timestamp = new Date().getTime();
that._transport = new SockJS[protocol](that, trans_url,
that._base_url);
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment