mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Added test for delivery of volatile json messages with websocket.
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user