I'm about to write a small chat application. To keep the flow of new messages coming, two things are possible. The first is to use a hidden frame, and to reload it every couple of seconds. The second would be to keep open the connection in the hidden frame (so the page is never realy loaded). I would prever the latter, but don't know how one keeps open the connection. What happens if the user closes the browser?