APP与网页实时通信 [英] Real-time communication between app and webpage

查看:88
本文介绍了APP与网页实时通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚如何通过使用 android 应用程序在网页上显示实时数据.

I'm trying to figure out how to have a real time data displayed on a webpage through the use of an android app.

例如,用户正在使用 Android 应用并被评分(回答问题).我的网页会按顺序实时显示分数.

For example, users are using android app and are scored (answering questions). My webpage will display the scores in order in real-time.

我得出的结论是使用Redis,但我到底需要什么才能让它发挥作用?我需要一个网络套接字来与我的网页进行通信吗?这个套接字可能是 python,它访问数据库,然后按顺序响应分数?

Iv come to the conclusion to use Redis, but what exactly do i need for this to function? Do i need a web socket where my web page will communicate with. This socket could be python where it accesses the database and then responds with the scores in order?

我正在努力弄清楚这到底是如何工作的,因为这对我来说是新的.我到底应该寻找什么(术语等)?

Im struggling to find out how exactly this would work as this is new to me. What exactly should i be looking for (terminology etc)?

谢谢

推荐答案

一种方法可能是:

  1. 在 Internet 上的服务器上设置数据库
  2. 编写您的应用程序以将数据保存到远程数据库
  3. 设置网络服务
  4. 对网络服务进行编程以从数据库中读取数据并将其作为 html 页面提供

额外的信用

  1. 实现一个 REST 风格的 API,它从数据库中检索和提供数据
  2. 创建一个使用 API 获取和显示数据的 ajax 网页(这样您就不必经常刷新页面)

这篇关于APP与网页实时通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆