Assume a private IM 1-to-1 scenario in which only 2 peers are connected.
Each peer has an inStream and an outStream, I can detect the following 4 disconnection events:
a) My Peer's inStream has disconnected : onInNetStreamStatus NetStream.Play.Stop
b) My Peer's outStream has disconnected : onOutNetStreamStatus NetStream.Play.Stop
c) Remote Peer's inStream has disconnected : onNetConnectionStatus NetStream.Connect.Closed //if(event.info.stream != inNetStream
d) Remote Peer's outStream has disconnected : onNetConnectionStatus NetStream.Connect.Closed //if(event.info.stream == inNetStream
From here, there are a couple options.
1) If I detect my peer has disconnected, I can try to reconnect to the other peer via stored farID
2) If I detect remote peer has disconnected, I can try to reconnect to the other peer via the stored farID
A potential problem I want to avoid here is both clients trying to reconnect to each other at the same time.
Note: I am not using NetGroup to avoid security dialog.
This "hiccup" reconnect seems like it would be a fairly common issue.
Any help here would be greatly appreciated.
So I have something working that reconnects a disconnected peer.
I when I detect that my peer has disconnected, I make sure the NetStream is destroyed and no longer in memory.
The remote peer is set to auto-reconnect when it detects a disconnection using event.info.farID.
Could someone please confirm best practices for this sort of thing?
Is this how other people are handling this?