- Home /
How to avoid database polling from unity?
I am working on a multiplayer project that is very database intensive. We use php webservices to communicate (and do some computations) between database and unity. Some of the webservices has to polled continuously to get the status/data from other other devices. Is there a better way to do it? Something like a trigger from db to notify a change and then I poll the db.
Answer by Bunny83 · May 20, 2017 at 08:12 AM
Well, if you want / need to stick with php you may want to look into long-polling techniques or WebSockets. Though a better approach would be to use actual socket connections since PHP isn't designed for such a usage. If you plan to have many users PHP won't be a good choice.
Client-server communication is always initiated by the client who's connecting to the server. So in order for the server to transmit something to the client, the client has to be connected. HTTP is designed as a request-response protocol and usually is only connected while waiting for the response. A probably better server side approach would be to use something like a NodeJS server.
Hey. Thanks for the quick reply. We were also thinking about moving to NodeJS in the future. But that will be a bit time consu$$anonymous$$g. I was thinking something like Google Cloud $$anonymous$$essaging where the cloud will send the trigger. Is there anything like that?
Your answer
Follow this Question
Related Questions
Manage data on Browser 0 Answers
Does AWS work with hololens for asset bundle downloading and general GET, PUT, POST requests ? 0 Answers
How to connect to oracle databases for webplayers 0 Answers
How the games are storing Bulk data of players and how they are processing? 2 Answers
MySQL connector failing to initialize MySqlClient ReplicationManager in Build 1 Answer