My task: Write a chat server that neither uses plugins/applets nor refreshes constantly at interval.
My solution: Exploit HTTP keep-alive to maintain a connection with the browser, printing to the browser as I recieve new data.
My problem: How to tell when the user has closed the browser or changed pages.
What I've tried: I've tried trapping for signals, but it seems like no signals are being thrown...even when I print to a dead socket. It seems as if printing to a dead socket throws no errors.
My question(s): 1)Is the browser really closing the connection when the user switches pages? My guess is a yes.; 2)How do I tell when the user has disconnected?; 3)If the browser isn't closing the connection when the user has left the page, then how do I force it to?
Blessed are those who follow the ways of Perl.
~Michael D. Stemle, Jr.