Home > Back-end >  ReactPHP, Websockets how to make connection between two servers and have a small command console
ReactPHP, Websockets how to make connection between two servers and have a small command console

Time:09-17

I am reading about ReactPHP and I really love PHP doing async things, that is adding so much flexibility.

I am trying to wrap my head around how to make 2 servers talk to each other while I can connect to my server (likely through an HTTP socket) to issue commands when need and observe the execution like a control panel/console.

diagram

I drew a diagram of what I mean, could someone please point in the right direction on what read/ right materials/methods, I am reading through ReactPHP at the moment but couldn't wrap my head around yet how to make it more or less 1<->2<->3 connection.

Thank you

CodePudding user response:

the system I'm developping does a similar thing. My ReactPHP solution has asynchronous communication with an websocket server using Ratchet/Pawl and asynchronous communication too with an HTTP browser where I can enter commands and receive/show results. Data are read/write to MySQL too. The ReactPHP program acts as an HTTP server and at the same time as an Socket client. It receives a command, assemble the command to be sent to the webserver. When the websocket answers, it formats the answer and send it to the users browser. Is this what you are looking for. If yes, I have to wipe the code to post on Gitter. Best

CodePudding user response:

Oh, I forgot to suggest, that you go to the ReactPHP support group at https://gitter.im/reactphp/reactphp

  • Related