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.