简体   繁体   中英

How do I create an AWS server that could recieve data continously from an IOS(swift) app?

I am trying to code an IOS application and already have an ec2 server designated for the app. I want to know how the app could send image data to the server. The ec2 server would receive incoming image data continuously from all the users that use the app. The server would then process the data. It would be similar to what applications such as Instagram do but, of course not at such a large scale.

I am a beginner at client-server communication and want to know how to implement this into my app. I also do not use stack overflow too frequently, so please tell me if I am doing something wrong if you need more information.

To be more specific, a user would post an image in the app. I currently have already set up an ec2 server to possibly receive that image. I want all of the images that users post to be delivered, processed, then stored in the ec2 server. Is there some way to handle the actual delivery of data. The question is a little broad because I want to know where to look. Would I have to write a script that is constantly running in the background and receiving data at some port? Is there another service I could use that handles this?

Um, briefly, you'll have issues with running on an EC2 if you have many users sending images at the same time.

Look into setting up API Gateway <-> Lambda <-> DynamoDB or S3 on AWS. Then your client can POST images/data to your gateway with a HTTP request.

First you must decide if your data is streaming (continuously pushed from server) or stored (pulled from the server as needed). The Instagram example you provided suggest that you have no need for real-time streaming data.

A streaming solution is more complicated and may typically require a technology like web sockets (or AWS IoT ) to accomplish. A storage solution will be much simpler.

For storing you have the choice between creating and managing server(s) using a platform like EC2 (you'll need more than one server to scale to many users), or using managed 'serverless' technology like Lamba where you only need provide the code. The tradeoff is for this convenience is usually price.

For image storage, a typical pattern is creating database records that contain an S3 URL for the underlying image (as well as any metadata). You can create this database record and upload your file using whatever server technology you choose; Lambda may require an API Gateway server but remember that the AWS SDK can invoke Lambda functions directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM