if you want to do that as soon as the user accidentally closes the browser (or navigates away from the site) that's impossible. If a short delay is acceptable the solution is a little complex and might be resource intensive but doable. If a long delay (i.e. session expiration) is acceptable than it is easier.
The first case is impossible 'cos the user is not communicating with the server when he closes the browser ;-)
The second case, involves polling the server with a keep alive message every x1 seconds and having an asynch component on the server that each x2 (greater than x1) seconds checks if there are any dead users and removes them. But it's a lot of work, and you are getting a request every x1 seconds for each user.
The third case is easier, but is related to the session timeout which, with some help, you can listen to (org.jboss.seam.preDestroyContext.SESSION event does the trick, almost).
Hopes it helps and good luck.
Hi i have tried this observer (org.jboss.seam.preDestroyContext.SESSION) but i will automatically called when i run my application can you explain how the configuration in components.xml look like?
help me sir