title: Using JavaScript / ActionScript to monitor browser windows from the same domain
body: <p>My webpage loads a background flash which will connect to the server using socket. 
  If a user open multiple windows/tabs of my website, the server will get multiple socket connections. Any idea of how to make sure that only one socket is connected from the same user and same browser?</p>
  
  <p>I am thinking of using Javascript to monitor the window close event, if a window that was connected to the server is closed, one of the other windows will try to connect to the server. But I can't find a way to listen to that event.</p>
  
  <p>I was thinking of Flash's LocalConnection too, but can't find a way to assign unique connection names and let other Flashes know.</p>