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 求解 yolo算法问题
    • ¥15 虚拟机打包apk出现错误
    • ¥30 最小化遗憾贪心算法上界
    • ¥15 用visual studi code完成html页面
    • ¥15 聚类分析或者python进行数据分析
    • ¥15 逻辑谓词和消解原理的运用
    • ¥15 三菱伺服电机按启动按钮有使能但不动作
    • ¥15 js,页面2返回页面1时定位进入的设备
    • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
    • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。