Hello!
In the process of creating one application (game) on JS, it became necessary to instantly exchange data with the server (data, for example, this is the current position on the playing field, which often changes), which then must also be quickly read by other clients. I tried to implement this through an Ajax request to a PHP server handler. At first I tried an asynchronous request - an insane delay (which is logical)! Then, it is not asynchronous - all game processes began to “freeze” (after all, the subsequent JS code in this case will be executed only after data is received from the server). In general, I am in a hopeless situation ... Tell me please, is there a way to instantly exchange data with the server? How is the instant data exchange implemented in other online games, in which changing various game properties is quite frequent?
Thank you =)