Skip to content

Instantly share code, notes, and snippets.

@konklone
Created December 10, 2012 01:54
Show Gist options
  • Save konklone/4247942 to your computer and use it in GitHub Desktop.
Save konklone/4247942 to your computer and use it in GitHub Desktop.
Stats from switching SockJS to use SSL.

Successful connections to a sockjs-node server, across various streaming transports, on Dec 8 and Dec 9, 2012. The only significant change made between those times that should affect connectivity is the switch to SSL, which I deployed within 5 minutes of midnight on Dec 9.

Visits as reported in Google Analytics ("visits in GA") are presented as a control. The number of successful connections (websockets+xhr-streaming) may be greater than the number of visits in GA. I don't know how GA calculates "visits", but it's still useful to show relative change in overall traffic.

Slight caveat: the time zones differ between GA and my server (EST vs GMT), so the 5 hour offset makes the traffic comparison imperfect. Still, it seems useful.

Dec 08 - http/ws://           Dec 09 - https/wss://
  Chrome                        Chrome
    visits in GA - 8690           visits in GA - 8602
    websockets - 8158             websockets - 10188
    xhr-streaming - 198           xhr-streaming - 67

  Firefox                       Firefox
    visits in GA - 2831           visits in GA - 3357
    websockets - 2757             websockets - 3567
    xhr-streaming - 111           xhr-streaming - 33 

  IE10                          IE10
    visits in GA - 39             visits in GA - 13
    websockets - 42               websockets - 68
    xhr-streaming - 3             xhr-streaming - 0

  IE9                           IE9
    visits in GA - 711            visits in GA - 666
    xdr-streaming - 734           xdr-streaming - 1

  iOS                           iOS
    visits in GA - 1996           visits in GA - 2383
    websockets - 903              websockets - 2166
    xhr-streaming - 128           xhr-streaming - 239
  • Switching to https/wss significantly boosted connectivity. Adjusted for overall change in visitors, Chrome's chance of getting through improved by 25%, Firefox by 5%, and iOS by 95%. IE10 seemed to show a big improvement, though the #'s are too small to be definitive.

  • Chrome, Firefox, and perhaps IE10 also saw the success rate of WS compared to XHR improve (fewer clients had to fallback to XHR). The proportion of WS to XHR on iOS stayed the same, even though connectivity through both of them doubled.

  • IE9, which can only connect through xdr-streaming, could not get through to an https URL. I observed a CORS cross domain error in the browser when I checked it out. The cert for the server belongs to my host and appears to be perfectly valid.

This was done on isitchristmas.com, with a separate sockjs-node server running on a temporary *.jit.su domain, both hosted on Nodejitsu. Nodejitsu provides SSL termination through node-http-proxy, and is specifically configured to allow real WebSocket connections over port 80 or 443.

Browser detection performed using the BrowserDetect library.

Bear in mind: some people report that switching one's WebSocket port from port 80 to anything improves connection success rates.

Client code - HTML/JS

Server code - main app - redis/analytics stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment