sockjs/sockjs-client — Issue #19: make XHR robuster
Author: dvv
Created: 2011-10-24 20:38:48+00:00
State: open

Hi!

I'm experiencing spurious "Polling error (permanent)" error w/o any particular reasons, sometimes even on localhost. Traces have led to https://github.com/sockjs/sockjs-client/blob/master/lib/trans-receiver-xhr.js#L32 where way strict condition `status === 200` sits. I figured out, that in interesting cases `status === 0` here.

Investigating further, gave:

http://stackoverflow.com/questions/1688073/jquery-ajax-call-occasionally-results-in-error-with-xmlhttprequest-response-st
http://stackoverflow.com/questions/872206/http-status-code-0-what-does-this-mean-in-ms-xmlhttp

Hence, I believe we should also count `status === 0` as abort status, and https://github.com/sockjs/sockjs-client/blob/master/lib/trans-receiver-xhr.js#L31 should read `(abort_reason || xhr.status === 0)`.

Please, test/validate/void

TIA,
--
Vladimir