This is a very interesting problem. I'm half tempted to code something up to see how it would work! (If only I had the time!)
First, as for localConnection causing a leak, I think you will really have to test that, but I think it's possible but I've done a fair bit with LocalConnection in similar situations and have never seen a signficant memory leak (which is also to say, figuring what is a memory leak and what is just the GC being slow is always difficult to figure in non-trivial code in Flash)
As for the larger question on how to build this thing, I can't give a definitive answer, but here are a few ideas.
It seems to me the flow of logic for each SWF has to go something like this:
- Check to see if I'm the first one (connect to the control channel)
- If so, start control channel and tell JS to start comet connection via ExternalInterface
- If not, connect to control channel and request two-way connection (at this point each slave SWF would generate a random ID and send that to the master - this ID would be used as the LC name for the data coming from the master to slave)
For handling the self-healing aspect I figure you could do something akin to a chain letter. That is, as each SWF connects to the master it could receive a list of the slaves. If the connection ever died each client would look to see where it was on the list. If it was the first slave on the list it would take over as the master - restart the control channel, and tell JS to start up a new comet connection. Then, each other slave would see that the server was back and would dequeue the now-master from their chain.
To handle holes in the chain from various clients dropping off, the master would coordinate that. Since it would be sending data to the slaves it would see immediately if a client dropped off. If a client did drop off it would simply tell the rest of the clients to remove that client from their chain.
Hope this helps!