Search code examples
flashapache-flexactionscript-3soundcloud-stratusadobe-cirrus

Adobe Cirrus: Quickest way to deliver a chunk of data to a single peer with known id


Adobe Cirrus offers a number of options for transferring data from peer to peer: Directed Routing, Object Replication and Multicasting to name a few.

I just want to send the data to one specific peer, its fine for other peers to 'see' it in transit.

My experiments with Directed Routing (the obvious answer) have not gone well. all the sendto... methods fail, while NetGroup.post works fine on the same netgroup. I am concerned about using direct connections because of reliability.

Has anyone successfully implemented a one to one messaging strategy (not one to many), which can still message between non-connected peers - (Directed Routing) or solved this problem successfully?

I am considering various workarounds, but I am quite perplexed that these NetGroup methods: sendToNearest, sendToNeighbour & sendToAllNeighbours just seem to fail, for no apparent reason.


Solution

  • Well, here's your problem, NetGroup isn't made for single peer 'send'. As the documentation says "Instances of the NetGroup class represent membership in an RTMFP group" and all those send methods are pertaining to the protocol neighbors (you'll need to read more into how RTMFP works; it's a really ingenious decentralized p2p protocol).

    Your only viable option is to use Direct Connection and it is just as reliable as using NetGroup. The only 'reliability' issue is with the connection to the peer. If you want something more robust, you'll need a 3rd party server but in my experience this is not needed. You just need to have a client listening for an incoming stream and have the other connect to the other peer using their peer id (you should already know the peer id through your own server implementation). When the connection is established, you just need to do netConnection.send('whatever');.