用于移动客户端/服务器应用程序的 Web 服务器和 Web 托管

发布于 2024-10-20 03:42:28 字数 608 浏览 6 评论 0原文

我想构建一个具有以下要求的移动应用程序:

  • 移动客户端应用程序应该从服务器上的数据库请求和接收数据。
  • 将来我可能想为同一个数据库构建一个 Web 应用程序。
  • 对于客户端和服务器之间的通信,我想使用 Google Protocol Buffers。

所以我有以下问题:

  1. 如何设置服务器来接受请求并以除 html 之外的任何内容进行响应。我认为使用 RPC 听起来不错,但我不知道如何在服务器上设置它。
  2. 我需要找到一个好的网络托管服务,它允许我设置一个数据库和一个服务器,可以为 Google Protocol Buffers 和常规网页提供数据服务。
  3. 在我开始制作网络应用程序之前,是否有任何更轻量级的解决方案可能更适合与客户端通信(甚至可能是自制的小型服务器),以及使用全规模的网络服务器来做到这一点有多难从一开始?

请为我指明正确的方向,以便我知道该读什么。 我不一定要寻找网络托管服务的具体名称,而是要了解哪些可用的服务可以满足我的需求。我使用过 django、Spring 和 Java EE,所以如果有任何涉及这些的解决方案那就太好了,但我并不害怕学习新东西。

预先感谢

西蒙

I would like to build a mobile application with the following requirements:

  • The mobile client applications should request and recieve data from a database on a server.
  • In the future I will probably want to build a web application for the same database.
  • For communication between the clients and the server I would like to use Google Protocol Buffers.

So I have the following questions:

  1. How does one set up a server to take request and respond with anything other than html. I think that using RPC sounds nice, but I have no clue how to set it up on a server.
  2. I need to find a good web hosting service which will allow me to set up a database and a server that can serve both Google Protocol Buffers and regular web pages with data.
  3. Before I get to making the web app, is there any more lightweight solution that might be better just for communicating with the clients (maybe even a home made tiny server), and how hard would it be to do it with a full scale web server from the start?

Please point me in the right direction so I know what to read up on.
I'm not necessarily looking for specific names of web hosting services but rather an idea what kind of services are available that might meet my needs. I've worked a little bit with django, Spring and Java EE so if there's any solution involving those that would be great, however I'm not afraid of learning something new.

Thanks in advance

Simon

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北渚 2024-10-27 03:42:28
  1. 如果您仍然指的是 http,那是非常简单的 - 您只需设置适当的内容类型,并将数据写入响应流。确切的方式取决于您的网络框架和工具,但这与(比如说)动态提供生成的图像没有什么不同。 HTTP 请求在消息传递场景中运行良好 - 就像使用 protobuf(等)主体发出 http 请求(通常是 POST)一样简单,并以相同的方式处理响应。

  2. 无法评论

  3. 网络应用可以轻量级;当然比配置非 http 服务/守护进程更重要。 “轻量级”选项是原始套接字,但这更难部署,并且您必须更加挑剔地选择主机。除非您绝对需要这种级别的简洁性(即删除 http 标头并编写自己的传输以接近线路),否则只需坚持使用 http - 开始和维护

对于信息,我有一个有关使用 ASP.NET MVC 执行此操作的博客文章;这并不意味着“做这个”(哎呀,使用任何可以帮助你的工具) - 简单地说,它是为了展示必要的事情种类

  1. if you still mean http, that is pretty trivial - you simply set an appropriate content-type, and write your data to the response stream. The exact how depends on your web framework and tools, but this is no different to (say) serving generated images on the fly. HTTP requests function fine for messaging scenarios - as simple as making an http request (typically POST) with a protobuf (etc) body, and processing the response in the same way.

  2. can't comment

  3. a web app can be lightweight; certainly more-so than having to configure a non-http service/daemon. The "lightweight" option would be raw sockets, but that is harder to deploy, and you'll have to be more picky choosing a host. Unless you absolutely need this level of terseness (i.e. dropping the http headers and writing your own transport to get close to the wire), just stick with http - it'll be a lot easier to get going and maintain

For info, I have a blog post on doing this with ASP.NET MVC; this isn't intended to mean "do this" (heck, use whatever tools help you) - simply, it is meant to show the kind of thing necessary.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文