tags:

views:

20

answers:

2

Hello, I am creating a chat application using JApplet. I created socket in init() method and everything seems to work fine. Now i want to send message "user has left the room" when he closes the window (in which JApplet resides) as well as also close the sockets.

I wrote my cleanup tasks in destroy() method. But they don't seem to work. Where is the correct place to write this logic, so that it works in all possible cases like user closes browser's close button or navigates to a different page?

Thanks in advance :)

A: 

Tried overriding stop() ?

aioobe
Actually destroy works fine. After debugging, i found out i was doing little mistake which is why message was not being sent.
Ankit Rathod
A: 

I assume you have some way of keeping track of whether the user is still logged into the room. If you build in an inactivity timeout period, you can automaticlaly log the user out if the user is inactive for the specified period.

Insectatorious