Skip to content

Commit

Permalink
Added test for polling with connection close.
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Apr 5, 2012
1 parent 09fb16b commit 6f36d8c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/transports.xhr-polling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,40 @@ module.exports = {
});
},

'test that connection close does not mean disconnect': function (done) {
var cl = client(++ports)
, io = create(cl)
, sid
, end
, disconnected = false

io.configure(function () {
io.set('polling duration', .2);
io.set('close timeout', .5);
});

io.sockets.on('connection', function (client) {
end = function () {
cl.end();
console.log('ending');
client.on('disconnect', function () {
disconnected = true;
});
}
});

cl.handshake(function (sid) {
cl.get('/socket.io/{protocol}/xhr-polling/' + sid);
setTimeout(end, 30);
setTimeout(function () {
console.log('finished');
disconnected.should.be.false;
io.server.close();
done();
}, 100);
});
},

'test sending back data': function (done) {
var cl = client(++ports)
, io = create(cl);
Expand Down

0 comments on commit 6f36d8c

Please sign in to comment.