Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

bug with jsonp-polling and IE <= 9 and transformer sockjs/engine.io #173

Closed
mrx8 opened this Issue Mar 14, 2014 · 12 comments

Comments

Projects
None yet
4 participants

mrx8 commented Mar 14, 2014

Hi,
this IE<=9 issues are really driving me nuts in the last days :)
In transformers/sockjs/library.js in line 444:
I disabled manually all protocols but jsonp-polling.

If I hit the browser-reload-button on my IE8/9 test-Page, the client connects to Primus with the following list of events, which I logged explicitly in the browser to see whats going on:

timeout
reconnecting
readyStateChange
readyStateChange
open
reconnect
readyStateChange
readyStateChange
readyStateChange
open

after that, every e.g. send("xyz", "hello"); from the server is "magically" double received on client side (I use primus-emitter), although the server sends it only ONCE (checked it with wireshark).
The same problem occurs using engine.io with Primus-connect-option websockets: false and IE8/9.

However, if I use google-chrome with websockets: false, everything works as expected:

readyStateChange
XHR finished loading: "http://w.x.y.z/primus/info". primus.js:2  <= this mesage is outputted by chrome
readyStateChange
open

no double-events or double-connects....

Can somebody confirm this ?

Regards
Andy

PS:
Don't ask why i forced jsonp ... It's the only protocol besides WebSocket, that does work with port 80. Normally it should do iframe-htmlfile, but this doesn't work if I use port 80. SockJS get stuck and primus emitting:

However, If I use e.g. port 8080 it works. And it's not a firewall problem...
IE>=10 or firefox/chrome does the job, without websockets...grrrr
But thats another problem :)

Member

lpinca commented Mar 14, 2014

I honestly don't know, do you have the same problem if you use Engine.IO or SockJS directly?
Just to confirm that it's a Primus issue.
When i have a chance to put my hands on a Windows machine, i'll try to reproduce this issue.

@3rd-Eden 3rd-Eden added the bug label Mar 14, 2014

Owner

3rd-Eden commented Mar 14, 2014

Similar to what is described in #117

Member

lpinca commented Mar 14, 2014

I tried to reproduce this issue using this simple test case https://gist.github.com/lpinca/9556764
Here is what i found.

IE9 + Engine.IO transformer

It seems to works fine. The result is always:

LOG: readyState 2 
LOG: readyStateChange 1 
LOG: readyStateChange 3 
LOG: open 
LOG: foo 

IE9 + SockJS transformer

For SockJS i disabled all transport but jsonp-polling as you said.
It usually works giving the same output as before, but on some page refresh it fails with this result:

LOG: readyState 2 
LOG: readyStateChange 1 
LOG: readyStateChange 2 

IE8 + Engine.IO transformer

I don't know what's wrong here, on some page refresh i had results like this:

LOG: readyState 2
LOG: timeout
LOG: readyStateChange 1
LOG: readyStateChange 3
LOG: open
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo
LOG: foo

But i could reproduce the same behavior in a plain engine.io server without Primus so i don't know what to think.

IE8 + SockJS transformer

In this case the result when it works is:

LOG: readyState 2
LOG: timeout
LOG: readyStateChange 1
LOG: readyStateChange 3
LOG: open
LOG: foo

but just like IE9 on some page refresh it fails giving this result:

LOG: readyState 2
LOG: timeout
LOG: readyStateChange 1
LOG: readyStateChange 2
Owner

3rd-Eden commented Mar 14, 2014

@lpinca was that against master or the current version that is npm?

Owner

3rd-Eden commented Mar 14, 2014

One thing that I did found is that we don't set the sockjs_url on the server. Which is a required param.

Member

lpinca commented Mar 14, 2014

@3rd-Eden master branch. I wonder why timeout gets triggered immediately in IE8. I will dig more tomorrow.

Member

lpinca commented Mar 15, 2014

Commit 925581b fixes the timeout issue with IE8 which was causing an unwanted reconnection immediately after the first connection.

With this fix if i use IE11 with emulation for IE8/9 i get no errors with both SockJS and Engine.IO.
SockJS has been forced to use only the jsonp-polling transport.

If i use a VM with native IE8/9 i still have some issues, in particular:

IE8/9 + SockJS

In some cases connection doesn't work and ends like this (with no reconnection attempt):

LOG: readyState 2 
LOG: readyStateChange 1 
LOG: readyStateChange 2 

IE8 + Engine.IO

I still have the weird behavior described above without the timeout event ofc. Again i can reproduce this in a pure engine.io server without Primus.

@mrx8 can you try to use the master branch and see if it fixes something for you?

npm i git://github.com/primus/primus#master

@lpinca lpinca referenced this issue in socketio/engine.io Mar 15, 2014

Closed

IE8 and 'polling' transport #233

mrx8 commented Mar 17, 2014

@lpinca it works!
My other problem with port 80 and "iframe-htmlfile" transport and sockjs got solved, too. I switched to cross-domain and port 443 => problems are all gone!
Before, everything was same-domain and port 80 which doens't work in IE<=9, only if you disable all transport-protocols but "websockets" and "jsonp-polling". I didn't find anything on the web concerning this issue. However I will need cors sooner or later, so no problem!
Many, many thanks for your help and time!!

@3rd-Eden
I think I have the same problem, when I use ie9 or ie8 with priumus socket.io || engine.io then I get this:

LOG: http://[thehostname]:8090/?ns=b3f0c7f6bb763af1be91d9e74eabfeb199dc1f1f
LOG: readyStateChange
LOG: outgoing::open
LOG: errorError: xhr poll error
LOG: readyStateChange
LOG: outgoing::end
LOG: close
LOG: end
LOG: incoming::error
LOG: incoming::end

using this as client:

this.socket = Primus.connect(this.host+'/?ns='+this.namespace, {
  reconnect: {
    maxDelay: Infinity,
    minDelay: 500,
    retries: 10
  },
  //  timeout: 30000,
  //  manual: false,
  //  transport: [ 'websocket', 'flashsocket', 'polling' ]
});

But I don't know what LOG: errorError: xhr poll error means.
Is there a way to see more debug info ?

Member

lpinca commented Mar 28, 2014

I'm closing this. All the issues here have been addressed.
The relevant commits are the following:

@gcmartijn If you still have that problem please create a new issue and if you can add a minimal test case to reproduce it. Thank you.

@lpinca lpinca closed this Mar 28, 2014

@lpinca
How do I install these 3 latest fixes ?

What I do now is first remove using
npm uninstall primus and then
npm install git+https://github.com/primus/primus.git

Member

lpinca commented Mar 31, 2014

@gcmartijn those fixes are included in the latest stable release so you can just run:

npm install primus@2.1.2

or better add it in your package.json (if you have one) by running npm install primus --save.

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