简体   繁体   English

如何创建可以从IOS(swift)应用程序连续接收数据的AWS服务器?

[英]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. 我正在尝试编写IOS应用程序的代码,并且已经为该应用程序指定了ec2服务器。 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. ec2服务器将从使用该应用程序的所有用户连续接收传入的图像数据。 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. 这类似于Instagram之类的应用程序所做的事情,但是当然规模并不大。

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. 我目前已经设置了一个ec2服务器来接收该图像。 I want all of the images that users post to be delivered, processed, then stored in the ec2 server. 我希望将用户发布的所有图像进行传递,处理,然后存储在ec2服务器中。 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. 嗯,简而言之,如果有许多用户同时发送图像,则在EC2上运行时会遇到问题。

Look into setting up API Gateway <-> Lambda <-> DynamoDB or S3 on AWS. 研究在AWS上设置API Gateway <-> Lambda <-> DynamoDB or S3 Then your client can POST images/data to your gateway with a HTTP request. 那么你的客户端可以POST图像/数据与一个HTTP请求的网关。

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. 您提供的Instagram示例表明您不需要实时流数据。

A streaming solution is more complicated and may typically require a technology like web sockets (or AWS IoT ) to accomplish. 流传输解决方案更为复杂,通常可能需要诸如Web套接字(或AWS IoT )之类的技术来完成。 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. 对于存储,您可以选择使用EC2类的平台来创建和管理服务器(您需要一台以上的服务器才能扩展到许多用户),也可以选择使用Lamba类的托管“无服务器”技术,而只需要提供以下功能即可:码。 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). 对于图像存储,一种典型的模式是创建数据库记录,其中包含基础图像的S3 URL(以及任何元数据)。 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. Lambda可能需要API Gateway服务器,但请记住,AWS开发工具包可以直接调用Lambda函数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Swift iOS中从服务器监听网络数据? - How do i listen for network data from the server in Swift iOS? 如何快速接收服务器的响应? - How to recieve response from server in swift? 如何在Swift ios编程中处理应用程序和服务器数据之间的不同时区? - How do I handle different timezones between app and server data in Swift ios programming? 如何将我的ios应用程序中的图像上传到存储在aws s3上的存储桶中,并在Swift中完成所有这些操作? - How can I upload an image from my ios app to my bucket stored on aws s3 and do all of that in Swift? Native IOS App从webbrowser javascript收到数据 - Native IOS App recieve data from webbrowser javascript 如何在 iOS 中使用 Swift/SwiftUI 将我从应用程序数据导出的文本文件移动到应用程序沙箱之外的位置? - How do I move a text file I exported from app data to a place outside the app's sandbox using Swift/SwiftUI in iOS? 如何在iOS应用程序中连续更改矩形的高度 - How to change the height of rectangle continously in ios app 在使用Swift的iOS中,如何创建始终在整个应用程序顶部的可拖动和浮动UIView - In iOS using swift, how do I create a draggable and floating UIView that is always on the top of throughout the entire app 如何使用Swift从iOS 8.1中的按钮按下加载iOS日历应用 - How do I load the iOS Calendar App from a button push in iOS 8.1 using Swift 如何在后台模式下为 iOS 应用程序创建“重新打开”应用程序按钮? (迅速) - how do I create “reopen” app button for iOS apps in background mode? (Swift)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM