Added test for delivery of volatile json messages with websocket.

This commit is contained in:
Guillermo Rauch
2011-05-22 14:39:43 -07:00
parent a5634b0bbd
commit 474f4e6ebd

View File

@@ -364,6 +364,40 @@ module.exports = {
ws.finishClose();
});
});
},
'test sending deliverable volatile json': function (done) {
var cl = client(++ports)
, io = create(cl)
, messaged = false;
io.configure(function () {
io.set('close timeout', .05);
});
io.sockets.on('connection', function (socket) {
socket.volatile.json.send([1, 2, 3]);
socket.on('disconnect', function () {
messaged.should.be.true;
cl.end();
io.server.close();
done();
});
});
cl.handshake(function (sid) {
var ws = websocket(cl, sid);
ws.on('message', function (msg) {
msg.should.eql({
type: 'json'
, data: [1, 2, 3]
, endpoint: ''
});
messaged = true;
ws.finishClose();
});
});
}
};