I need to use jsonp-polling for IE, and xhr-polling for Firefox, so I tried to define types of transports on the client side like this:
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
var socket = io.connect(VG.NODE_SERVER_URL,{
transports:['xhr-polling']
});
} else if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
var socket = io.connect(VG.NODE_SERVER_URL,{
transports:['jsonp-polling']
});
} else {
var socket = io.connect(VG.NODE_SERVER_URL);
}
I tested it on Firefox and added logging on socket.io-client lib. At
https://github.com/LearnBoost/socket.io-client/blob/master/dist/socket.io.js#L1509
the option.transports is ["xhr-polling", "flashsocket", "htmlfile",
"xhr-polling", "jsonp-polling"]
, which is right. However, at
https://github.com/LearnBoost/socket.io-client/blob/master/dist/socket.io.js#L1679
I do not know why the transports change to ["htmlfile", "jsonp-
polling", "xhr-polling"]
, which has the same sequence as what I
defined on server side.
Why doesn't it use the previous option?