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 如何实验stm32主通道和互补通道独立输出
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题