Answer the question
In order to leave comments, you need to log in
How can I connect a PHP server to a qt application?
Cloud gaming
There is an application on qt that launches the game and sends requests to the server to receive information and give information about the played time.
There is a php server that responds to requests and interacts with the database.
How can I track the game time in the application so that when the application is closed, information about the played time is saved on the server?
I'm interested in the implementation logic itself, my version of how to do this is as follows: Every minute (any interval), the application sends a request to the server, and the server changes the number of minutes left on the player's account.
This system includes quite a lot of requests especially when scaling, how can this be done better or is this the only way?
Answer the question
In order to leave comments, you need to log in
I suspect that WebSocket will fit better here.
We fix the connection time, periodically helmet "ping", count the minutes. When disconnected, we also count the minutes (from the connection or the last ping).
The problem is that PHP is not very suitable for working on WS, because. requires running as a daemon. Those. possible, but labor intensive.
It is possible to fasten a mini-service to node.js from the side.
Or make it in the "request every N minutes" format, and refine it after problems with scaling (if it comes to them).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question