mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Expose socket.transport
This commit is contained in:
@@ -1642,5 +1642,36 @@ module.exports = {
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
'accessing the transport type': function (done) {
|
||||
var cl = client(++ports)
|
||||
, io = create(cl)
|
||||
, ws;
|
||||
|
||||
io.sockets.on('connection', function (socket) {
|
||||
socket.transport.should.equal('websocket');
|
||||
|
||||
socket.on('disconnect', function () {
|
||||
setTimeout(function () {
|
||||
ws.finishClose();
|
||||
cl.end();
|
||||
io.server.close();
|
||||
done();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
socket.disconnect();
|
||||
});
|
||||
|
||||
cl.handshake(function (sid) {
|
||||
ws = websocket(cl, sid);
|
||||
ws.on('message', function (msg) {
|
||||
if (!ws.connected) {
|
||||
msg.type.should.eql('connect');
|
||||
ws.connected = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user