1

Consider these two kinds of contexts / applications:

1) When you hit a button on a page containing several input fields (the page is not a HTML form), all the infos are retrieved and sent to the server. The server then performs several tasks with that data, such as:

a) ulpoad a provided image

b) register a new row in database according to info

...and so on.

After completing each of these steps, the server sends a message to the client to inform about which process is currently being carried out on the server-side.

To do all of this, I used WebSockets (Ratchet for PHP WebSocket Server configuration, JavaScript for Browser Client Side). So far so good.

2) Next, I want to make a simple chat application, real-time, similar as Whatsapp, Telegram, etc. To do so, I also want to use WebSockets (again with Ratchet PHP on server - side and Js on client - side), but in this context, I came across ZeroMQ, and I don't really understand its purpose, no matter how many guides I read / videos I watch.

From what I understood so far is that ZeroMQ would allow the WebSocket communication to flow across a separate TCP connection, while the actual website would keep running its habitual HTTP requests across another one. Is that the only difference? In other words, is it an absolute MUST to use ZeroMQ when building chat applications with WebSockets (Consider that I run the both the WebSocket Server script as well as the website on the same server).

DevelJoe
  • 856
  • 1
  • 10
  • 24
  • Where did you see anything about websocket *over* ZeroMQ…? You can of course use ZeroMQ in your backend architecture, that's pretty separate from websockets. You'd use ZMQ if you want a job queue with several workers. A decent explanation of that kind of architecture can be found here: http://gearman.org – deceze May 18 '20 at 13:13
  • 1
    here you have one presentation talking about an architecture using Websockets AND ZeroMQ, and I'm not really getting why u need to both for chat applications: https://blog.chefduweb.nl/2017/04/realtime-wordpress-websockets/ Even on the documentation of Ratchet, they mention it, also in a not-so-clear way to me (from a "why do I need that" point of view, not concerning the implementation instructions): http://socketo.me/docs/push – DevelJoe May 18 '20 at 13:16
  • Can Ratchet send messages to multiple connected clients at once? That's something zmq does out of the box. I'm not familiar with Ratchet, but if it can do that, you have no need for zmq – smac89 May 19 '20 at 00:12

0 Answers0