reactphp / reactphp

Event-driven, non-blocking I/O with PHP.

Home Page:https://reactphp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does ReactPHP 1.3 work with ZMQ?

fuad-tareq opened this issue · comments

I am using react/zmq which uses ReactPHP's event loop. Recently, I came to learn that ReactPHP can do async tasks using promises which I was excited to use. Unfortunately, I quickly came to find out that the react/zmq library, while it uses ReactPHP, uses an older version of ReactPHP... which lacks one of ReactPHP's newer components, async, which I believe I'd very much need for what I plan to do with my async task; which is to:

  1. Repeatedly query a 3rd-party API for a thumbnail every 5 seconds.
  2. Once the thumbnail is received, download the thumbnail and save it to the server.
  3. Update the DB with the new thumbnail's file location.
  4. Send a message to the client updating the new thumbnail.

I thought that perhaps I could update the ReactPHP part of that library but doing a composer require react/react:^1.3 (even with the --with-all-dependencies added) didn't work due to a conflict. Any ideas what I can do to get this working? It is kind of hard to follow your documentation with an older version of your library.

Hey @fuad-tareq, thanks for bringing this up 👍

I am not quite sure if I follow your issue correctly, but if you want to use the async component for your project, I'd say it is easier to use this component alone instead of updating all of ReactPHP. This is the positive side of our component structure, you can just pick the ones you need and don't have to care about the ones you don't need.

Does this helps you to get going or did I talk nonsense here? :D