To disconnect the client I go through the clients array backwards
I'm only using netservices.asc.
load("netservices.asc");
To disconnect the client I go through the clients array backwards, find the
client to disconnect, and disconnect it. (logInfo is a custom function I
added to client objects. It gets called but some clients stay alive)
for ( var i=application.clients.length-1; i>=0; i--){
var difference = nowTimestamp - application.clients[i].lastHeartbeat;
if( difference >= 10*1000 ) {
if( application.clients[i] ){
application.clients[i].logInfo("Timeout: ("+difference/1000+") s"
);
application.disconnect(applica tion.clients[i]);
}
}
}
I'd be just too happy if you can find an error in this way of disconnecting
clients. When I test stuff, I also can't reproduce the problem. My software
is in production, and there it happens. There seem to be two different
kinds of dead client connections. One of them can be disconnected and
the other just can't be killed.
load("netservices.asc");
To disconnect the client I go through the clients array backwards, find the
client to disconnect, and disconnect it. (logInfo is a custom function I
added to client objects. It gets called but some clients stay alive)
for ( var i=application.clients.length-1; i>=0; i--){
var difference = nowTimestamp - application.clients[i].lastHeartbeat;
if( difference >= 10*1000 ) {
if( application.clients[i] ){
application.clients[i].logInfo("Timeout: ("+difference/1000+") s"
);
application.disconnect(applica tion.clients[i]);
}
}
}
I'd be just too happy if you can find an error in this way of disconnecting
clients. When I test stuff, I also can't reproduce the problem. My software
is in production, and there it happens. There seem to be two different
kinds of dead client connections. One of them can be disconnected and
the other just can't be killed.
Nhận xét
Đăng nhận xét