Revert "Make timestamping default for sockets"

This reverts commit efc5ff99d1.
This commit is contained in:
Guillermo Rauch
2014-02-20 10:54:51 -08:00
parent 46617c995c
commit 0beb956530
4 changed files with 13 additions and 31 deletions

View File

@@ -160,8 +160,9 @@ Exposed as `eio` in the browser standalone build.
to upgrade the transport from long-polling to something better.
- `forceJSONP` (`Boolean`): forces JSONP for polling transport.
- `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary.
- `timestampRequests` (`Boolean`): defaults to true, whether to add the
timestamp with each transport request.
- `timestampRequests` (`Boolean`): whether to add the timestamp with
each transport request. Note: this is ignored if the browser is
IE or Android, in which case requests are always stamped (`false`)
- `timestampParam` (`String`): timestamp parameter (`t`)
- `flashPath` (`String`): path to flash client files with trailing slash
- `policyPort` (`Number`): port the policy server listens on (`843`)

View File

@@ -77,7 +77,7 @@ function Socket(uri, opts){
this.forceJSONP = !!opts.forceJSONP;
this.forceBase64 = !!opts.forceBase64;
this.timestampParam = opts.timestampParam || 't';
this.timestampRequests = opts.timestampRequests !== false;
this.timestampRequests = opts.timestampRequests;
this.flashPath = opts.flashPath || '';
this.transports = opts.transports || ['polling', 'websocket', 'flashsocket'];
this.readyState = '';

View File

@@ -224,8 +224,15 @@ Polling.prototype.uri = function(){
var schema = this.secure ? 'https' : 'http';
var port = '';
if (this.timestampRequests) {
query[this.timestampParam] = +new Date;
// cache busting is forced for IE / android / iOS6 ಠ_ಠ
if ('ActiveXObject' in global
|| util.ua.chromeframe
|| util.ua.android
|| util.ua.ios6
|| this.timestampRequests) {
if (false !== this.timestampRequests) {
query[this.timestampParam] = +new Date;
}
}
if (!this.supportsBinary && !query.sid) {

View File

@@ -30,30 +30,4 @@ describe('Socket', function () {
});
});
it('should give sockets different ids or mandate timestamps', function(done) {
var sockets = [];
var remaining, total;
// Create this many sockets during this event loop
remaining = total = 4;
for (var i = 0; i < total; i++)
{
sockets[i] = new eio.Socket();
sockets[i].on('open', function() {
remaining--;
if (remaining == 0) {
// Ensure sockets don't have same ids, if they are not using time stamps
for (var j = 0; j < sockets.length; j++) {
for (var k = j + 1; k < sockets.length; k++) {
if (!sockets[j].timestampRequests && !sockets[k].timestampRequests) {
expect(sockets[j].id).not.to.equal(sockets[k].id);
}
}
sockets[j].close();
}
done();
}
});
}
});
});