{ [Error: xhr post error] type: 'TransportError', description: 503 }
socket.io client connect server client throw this error
{ [Error: xhr post error] type: 'TransportError', description: 503 }
more error info
socket.io-client:manager will wait 1167ms before reconnect attempt +0ms
engine.io-client:socket probe transport "websocket" failed because of error: socket closed +1ms
engine.io-client:socket socket error {"description":503} +0ms
socket.io-client:manager error +1ms { [Error: xhr poll error] description: 503 }
other question why i use socket.io-client connect server ,the transport is polling not websocket?
What versions of server and client do you use? You basically need to use a same version.
why i use socket.io-client connect server, the transport is polling not websocket?
This is because socket.io uses polling first and attempts to upgrade transport to websocket by the default setting.
i used socket.io and socket.io-client v.1.3.3
Umm, I believe this is not the problem of socket.io since it sounds a very basic error and is well tested. Could you check your code again? Please post your code here If you couldn't resolve this.
i used socket.io-client to stress test. server code:
//app is express V.3.x
var server = exports.server = require('http').createServer(app);
var io = exports.io = require('socket.io')(server, {
allowUpgrades: true,
transports: ['websocket', 'flashsocket', 'polling'],
'log level': 1,
'pingTimeout': 1000 * 80,
'pingInterval': 1000 * 25
});
var RedisStore = require('socket.io-redis');
var pub = redis.createClient(config.redis.port, config.redis.ip);
var sub = redis.createClient(config.redis.port, config.redis.ip, {detect_buffers: true});
io.adapter(RedisStore({pubClient: pub, subClient: sub}));
client code:
io.connect(config.serverAdd + '/wsservices', {
'forceNew': true,
'sync disconnect on unload': true,
reconnect: false,
query: {
bestvid: "___" + bestId + "___",
client_id: clientId,
client_name: bestId,
token: token,
platform: platform
}
});
So it seems your app was upgraded from 0.9.x to 1.3.3. I think you have to fix some options for the latest version, since there are a ton of changes between these versions.
Especially, I wonder the transports would work with the setting (['websocket', 'flashsocket', 'polling']).
client or server?
Both have to be fixed. Please see the doc for the details.
http://socket.io/docs/migrating-from-0-9
i write a testcase to stress test. i run 1000 client to connect server once. when i run three time's the connect will be slowly and many reconnect event.
[root@localhost]# ulimit
unlimited
i don't know why, in the v0.9 not existed this question.
some debug info
Thu, 12 Feb 2015 07:05:04 GMT engine.io-client:socket socket closing - telling transport to close
Thu, 12 Feb 2015 07:05:04 GMT engine.io-client:socket socket close with reason: "forced close"
fixed,this error need to set client transports like this.
io.connect(config.serverAdd + '/wsservices', {
...
transports: ['websocket''],
....
});
When I set transports to ['websocket'], I got an error 'connect_error', [Error: websocket error]. But, when I change to { transports: ['websocket'] }, I also got an error 'connect_error', [Error: xhr poll error]
+1
+1
@minhquankq how did you solve it?
+1 here (after many connection depending on the hardware machine)