dt4233 2018-09-26 18:19
浏览 88

移动应用程序,短轮询与长期轮询Web服务

After searching for several day I need to confirm with you this. I'm making an Android app and a Unity 3D mobile game. I'm adding functions like messaging in app, friends and achievements. I'm using PHP and Mysql in the server side. For every action like add-friend, send-message, check-for-new-messages I use single PHP file for every one. The process is :

APP send POST data, 
PHP process query , 
Mysql delivers info to php,
PHP delivers info, 
APP uses that info.
Repeat every 3-5 seconds to simulate real time.

Why should I use long polling? I understand that the pseudocode should be:

APP send POST data, 
PHP process query , 
if there is new info
Mysql delivers info to php,
PHP delivers info,
else wait 2-3s and then goto "PHP process query". 
APP uses that info.

I'm using only PHP and Mysql because I think that using a classic web hosting will work fine and cheap. Should I use long or short polling?

Or should I use an existent service? And which ? Firebase? Google Cloud? AWS? Azure? Thank for you time. I don't know wich book or reference should I use for this.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)