About the role of the PHP server as an intermediate transit station?

good evening, big gods. I have this need: the PHP server acts as a middleman to communicate between the mobile app end and the hardware device (roughly like this, some words may be unprofessional). In some cases, the app side and the hardware side take the initiative to call up the PHP interface to communicate through http. There is a situation (I am fascinated here) that requires the PHP server to actively communicate with the mobile phone and the device (that is, to actively tell the two ports what needs to be done), how to solve this requirement? What kind of technology needs to be used? Please give me some advice! Please


php actively communicates with mobile devices? So how did php find them?
feels the need to make a long connection. The mobile device first requests the server to pull the long connection, and then the server sends it. But php is not naturally suitable for long connections, so you can take a look at wheels such as swoole, or (if possible) replace them with stacks such as Node.js that are suitable for long connections.


this is actually PHP as the server, and App and hardware as the client, which can also be thought of as the data sender
. Then it is divided into two scenarios

.
  • non-instant messaging scenarios

    • for example, just some data is collected from hardware. If users on App take a look at it from time to time, they only need the php server to store the data in the database, and then check it when App calls the API request
  • Instant messaging scenarios, such as instant monitoring client data

    • Instant messaging scenarios can use HTTP polling or establishing socket persistent connections. Swoole is a very good choice for socket, especially for later swoole4.x. There is nothing to say about HTTP polling. Request data once every two or three seconds
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e44947-44ac5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e44947-44ac5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?