Jguery plugin: reset connectionCount after reconnect
Jguery plugin: either reset connectionCount after successful connection or provide a method to do that. Second option requires new event handler or a new request state. In version 1.0.4 it is not possible to know when there is a successful reconnect. onOpen is hit just once. I think that there is a connecting or reconnecting state, but not something like connected.
I'm not sure I understand the issue. connectionCount is not in atmosphere.js . Do you means maxRequest? Are you hitting the max of 60 requests? If yes, this is fixed in 1.0.5
I think i know what he means.
There needs to be a limit on number of requests to prevent DoS, but there should be a way to allow legitimate connections indefinitely, if the client runs for a long time...
With long-polling, when the suspended connection is aborted on the server-side, client sends another GET to keep it alive. But if the server goes down for some reason, and every incoming connection is aborted, this results in all clients spamming the server with GETs as fast as it can.
I think, one way to prevent this would be to have two maxRequest variables. one for all requests, as it is now, and another for consecutive aborted request that come within a certain time frame from each other.
@nite23 You read my mind..look at the commit I did earlier today under #759 umbrella :-) This is included in 1.0.5 release
Sorry, forget connectionCount, I mean request.requestCount
Issue https://github.com/Atmosphere/atmosphere/issues/759 is OK. Maybe an idea to reduce the number of settings and let the application decide about making another connection.
example:
atmosphere.js:
doReconnect(request){
// here comes default atmosphere implementation
};
outside atmosphere.js:
var maxReconnectAttempts = 10;
var reconnectAttempts = 0;
request.doReconnect = function(request){
if (maxReconnectOnClose <= reconnectAttempts){
return false;
}
};
request.onReconnect = function(request, response) {
reconnectAttempts++;
};
request.onOpen = function (response){
reconnectAttempts = 0;
};
Closing as fixed