mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Added test for undeliverable volatile events for websocket.
This commit is contained in:
@@ -280,6 +280,52 @@ module.exports = {
|
||||
}, 10);
|
||||
};
|
||||
|
||||
ws.on('message', function () {
|
||||
messaged = true;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
'test sending undeliverable volatile events': function (done) {
|
||||
var cl = client(++ports)
|
||||
, io = create(cl)
|
||||
, messaged = false
|
||||
, s;
|
||||
|
||||
io.configure(function () {
|
||||
io.set('close timeout', .05);
|
||||
});
|
||||
|
||||
io.sockets.on('connection', function (socket) {
|
||||
s = socket;
|
||||
|
||||
socket.on('disconnect', function () {
|
||||
messaged.should.be.false;
|
||||
cl.end();
|
||||
io.server.close();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
cl.handshake(function (sid) {
|
||||
var ws = websocket(cl, sid);
|
||||
ws.onopen = function () {
|
||||
ws.finishClose();
|
||||
|
||||
setTimeout(function () {
|
||||
s.volatile.emit({ a: 'b' });
|
||||
|
||||
ws = websocket(cl, sid);
|
||||
ws.on('message', function () {
|
||||
messaged = true;
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
ws.finishClose();
|
||||
}, 10);
|
||||
}, 10);
|
||||
};
|
||||
|
||||
ws.on('message', function () {
|
||||
messaged = true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user