lundi 25 avril 2016

How to talk between HTTP request & cli class objects

I have a application running that's listing to HTTP request. Each request is passed to single page where a framework object $app is instantiated and this takes care of routing / controller / model etc.

Now i have a another class whose object is instantiated via. a CLI script lets call it $cliApp now problem is how do i make both the object talk to each other. $app is instantiate every-time there is a new request.

But $cliApp is instantiate only once when script is ran. This scripts runs in loop via $loop object by PHP React Event loop.

Cli App is running websockets. So basically i want http & sockets to communicate via. http api.

P.s. :

Right now i have one solution to use message queueing e.g. 0mq etc. but that seems overkill since i'm not looking to scale and keep it simple.

Aucun commentaire:

Enregistrer un commentaire