Yeah, that's a nice idea. For folks that use polling (with a polling interval of a few seconds) or long polling (with a server-side wait of up to a minute or two), if you tune your session timeout down to a little more than your polling roundtrip time then clients that are closed will not issue any more polls and their server sessions will be cleaned up pretty quickly. For streaming connections, which ping the client periodically if the connection is quiet, the session will stay alive as long as the streaming connection is open. When it closes, the session will get a chance to time out, so here as well, tuning down to a minute or two would probably do the trick.
If you need to shoot for more immediate disconnect notification, see the comments for the thread titled: Re: Is it possible to invoke a AMF call just before browser close? If you're doing RPC style interaction (no messaging) with the server over a non-polling, non-streaming channel, Todd's approach is a great way to handle this (he's avoiding busy polling the server by scheduling his keep alive ping just a bit shorter than his tuned down server session timeout). If you're using a polling or streaming channel you don't need to do this manually because the channel is doing more or less the same thing on your behalf. Seth From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of twcrone70 Sent: Tuesday, May 20, 2008 6:16 AM To: [email protected] Subject: [flexcoders] Re: Is it possible to invoke a AMF call just before browser close? My guess is this is highly unlikely to work consistently if at all. We simply have our session timeout short enough that the session will not be 'orphaned' very long. In the client app, we put in a 'keep alive' call to 'something' on the server on a timer shorter than the session timeout. If this call fails, it tries again several times more quickly before warning the user that the server session may have timed out or something. Not sure if this is a great idea but I'd love to hear any other suggestions on this one. - Todd --- In [email protected], "meteatamel" <[EMAIL PROTECTED]> wrote: > > I'd try onunload and onbeforeunload events to see they help. If that > doesn't help, I'd try putting up an Alert box before making the AMF > call to make sure AMF call is made before the browser is closed. > > -Mete > > --- In [email protected], "Dan" <yldleung@> wrote: > > > > Hi, > > > > I am trying to invalidate a session by explicity invoke a AMF call > > when the user click logout or closing the browswer. > > > > By ExternalInterface, the CLOSE event is capture within the FLEX > > correctly. But by tracing in the debugger, if a AMF is invoke upon > > this, the call did invoke but the AMF call is not sent to through the > > FDS, I wonder if the application is being killed before the FDS > > successfully sent the request. > > > > Is it not a good idea to invalidate a session in this way? Any > > Flexpert suggestion? :> > > > > Dan > > >

