P2P Game - rtmfp netconnection local WIFI issues!
Hi,
We are developing a turn based game that requires two players to connect over local wifi.
At the moment we are using Lee Burrows tutorial and code located here:
http://blog.leeburrows.com/2011/11/p2p-flash-on-a-local-network-part-3/
We are developing our app using Flash builder 4.6 and Adobe air and deploying to IOS and Android as a standalone application.
So far we have successfully managed to get a basic chat service up and running between two (and more) devices using the tutorial and code above - the problem comes when we are in the middle of a chat between two devices and one device goes to - or is put to sleep - in that on IOS (on an iphone or ipad) if the device is put to sleep by the user when the chat app is running - and the device is then woken again and the app 're-opened' or 'maximized' from the dock - the app then FREEZES/CRASHES when trying to re-post a message to connected other peers in the netgroup.
Essentially it doesnt look like IOS allows you to maintain the rtmfp p2p connection if the device is put to sleep when the app is still running. We do not have this problem on Android which appears to maintain the rtmfp connection regardless of whether we put the device to sleep and then wake it and reopen the app - as in this instance we can successfully just carry on the chat (or game as it will eventually be).
We have done some reading around on this and it appears Android allows 'background execution' but that IOS doesnt.. could this be the reason IOS is freezing when the app is reopened from the dock and we try to re-post after the device has been woken from 'sleep'?
The only way we have found to make it not freeze on IOS is to listen for DEVICE exit and deactivate events - close() the net connection when these are heard and then re-open a new netconnection when the activate device event is heard.. but this seems unnecessary...
Any advice/input on this would help guys,
Cheers,
T.
p.s. The other issue we are exeriencing is that occasionally if a device goes to sleep - the other devices in the netgroup are not always hearing NetGroup.Neighbor.Disconnect - meaning a device that has left is not always removed from the group... but readded with a new id if that device then rejoins at any point, leading to multiple obsolete device ID's..
