Hello,
Can you tell me please the best approach to implement an online game playing? I have one server with php (for me, the most affordable) which plays as the game server (online players, receive and send message from one device to one or multiple devices,...). It's a simple board game but another devices can watch the game party.
I see some examples with MQTT and Firebase or B4J server but I would like to implement it with php only as It's what is available to me now.
What I did is:
- I implemented a rest api server with php on the server
- With android devices, I used okhttputils2 for the communication. Devices send command to the server and wich interprets the command and sends the response immediately to the sender or store some information in the database and wait for another device command before putting some response in the database for the initial sender. The initial send checks regularly that response via http get/post and acts depending the response.
I think it's not a good approach as many datas are sent from the device to the server just for checking some availaibility of response on the database. And also, I didnvt check battery power consumption.
With sockets and only 2 devices, it's okay and easy to implement but with multiple devices and a php server, I didn't find how to do it.
Should I use MQTT for this?
Thank you
Can you tell me please the best approach to implement an online game playing? I have one server with php (for me, the most affordable) which plays as the game server (online players, receive and send message from one device to one or multiple devices,...). It's a simple board game but another devices can watch the game party.
I see some examples with MQTT and Firebase or B4J server but I would like to implement it with php only as It's what is available to me now.
What I did is:
- I implemented a rest api server with php on the server
- With android devices, I used okhttputils2 for the communication. Devices send command to the server and wich interprets the command and sends the response immediately to the sender or store some information in the database and wait for another device command before putting some response in the database for the initial sender. The initial send checks regularly that response via http get/post and acts depending the response.
I think it's not a good approach as many datas are sent from the device to the server just for checking some availaibility of response on the database. And also, I didnvt check battery power consumption.
With sockets and only 2 devices, it's okay and easy to implement but with multiple devices and a php server, I didn't find how to do it.
Should I use MQTT for this?
Thank you