I'm trying to make one peer application detect when another connected peer disconnets (for example just closes the browser window).
I tried adding NetStatusEvent.NET_STATUS to all the opened NetStreams and I also tried adding the onPeerDisconnect handlers to NetStream clients. None of them fire when peer disconnects.
However, onPeerConnect works perfectly fine for me.
I think that when a peer connection closes, you will see a NetStream.Connect.Closed status
event on the NetConnection. So, install an NetEvent handler on the NetConnection and look for NetStream.Connect.Closed events.
That particular event will have a property called "stream" which indicates which NetStream closed.
Thanks a lot, it works perfectly fine now.
Just to make it totaly clear, for anyone having the same problem:
- you have to add the NetStatusEvent.NET_STATUS to the NetConnection object, and NOT to the NetStream object.