Expand my Community achievements bar.

File transfer (not necessarily upload, then download)

Avatar

Former Community Member

Hey guys.  I'm just getting into AFCS and strategizing on a new app I'm building.  It seems like a client can use a FilePublisher to upload a file to the AFCS server, then, after the file is uploaded, a different client can use a FileSubscriber to download the file.  What I'd like to do is make that somewhat simultaneous, in other words, rather than having my app act like an FTP client, make it act like a P2P client (so one client uploads while another client downloads).  I realize I can do this in true P2P fashion with RTMFP and the Stratus service, but it's based of UDP which I believe means I lose file integrity.  How would I go about doing this?  Have I misunderstood anything?

Thanks.

Aaron

2 Replies

Avatar

Employee

Aaron,

Currently we only offer file upload/download (via FilePublisher/FileSubscriber) but the correct workflow is slightly different than what you describe. If a client is using FileSubscriber to listen to file events it gets notified as soon as the file upload starts, while the file upload is in progress and when the upload is ready. You still cannot get data while the file is being upload but at least you can make the process automatic.

If you need something more real time you may have to implement your own data transfer, by creating a node with items that contain binary data (chunks of your file) and implement your own flow control (if the file is small enough it may be ok for the publisher to publish the full file even if the subscriber is slow in receiving and removing them, if the file starts to get bigger you really want to publish only a few chunks and then wait until they are consumed).

You could implement this also with RTMFP and Stratus if you use the data messaging API (shared objects or NetConnection.call). Those guarantee data integrity, in order to be compatible with RTMFP (RTMFP is a connection oriented protocol on top of UDP, same as TCP but with the ability to drop packets that are "droppable", like video frames and such)

Avatar

Former Community Member

Very very helpful.  Thank you.  It looks like RTMFP with Stratus is going to do just what I need.  If I understand right, sending a ByteArray using NetStream.send would qualify for data integrity?  Any idea what's going on underneath the hood?  When sending a ByteArray using NetStream.send() is there error checking to make sure all the packets arrive safely, whereas sending video/audio using NetStream.attachCamera and NetStream.attachAudio allows them to drop?  I hope I understood correctly.

Thanks.

Aaron