Is it possible to free a session just after the client disconnects, using SuperHTTP server ?
Hello,
There is no simple way to do this. You could use two different solutions:
(1) Let the client call a dedicated method on disconnect
(2) More sophisticated:
- subclass TROInMemoryEventRepository class and override RemoveSessionActiveListener method. This method is called when the client disconnects either cleanly or when assumed to be dead.
- assign the TROInMemoryEventRepository subclass instance to server channel’s EventRepository prop even there is no need to send callback events to catch the disconnection calls with the overriden method.
I’ll try with method 2, i would like to free the session also when the client disconnects abnormally i.e. when its internet connection goes down.
When does Remobjects assumes a client ‘to be dead’?
Is there a timeout or does this occur when an event cannot be delivered?
This can happen frequently when a computer temporarily disconnects or hybernates.
Hello,
infokevercom said: When does Remobjects assumes a client 'to be dead'?There are two layers. The first is the matter of sockets and socket connections. For SuperHTTP the connection is assumed dead if there is no incoming activity (the client must reestablish it's waiting connection periodically) during ConnectionTimeout seconds. In case of SuperTCP the connection is assumed dead if it does not respond to PING packages from the server and there is no other incoming activity. The second layer is the sessions logic. If there is no activity for the session it expires after certain timeout determined by the session manager. So the client can open and close connections several times but it's session is kept until timeout. This works the same way regardless to the channel used. According to RO architecture principles it is recommended to stay at the second layer, it allows to be unaware of low level connection specifics. It is up to developer to determine how long the session have to be kept.
Best regards - Sergey.