Only post if the listener exists?

using RabbitMQ, I would like my (PHP) code to post a message to a specific client only if that particular user is currently listening.

The reason for this is that my connected user will open a website that will wait for notifications from RabbitMQ and update the user interface when notifications arrive. But when they first load the page, all previous notifications will be loaded, so there is no need to restart the notifications that are in the queue.

As a newbie to the message queue, I don’t know if this is possible, but I would like my publisher to check if the user id = X is currently listening (since websocket will open the channel on execution), and if it is currently listening, by posting. If he does not, he will not publish this message (but add it to the database).

The workflow is as follows:

Publisher:

  • Endpoint receives event
  • Stores an event in the database
  • It checks if the user ID = X has an open channel, if so, he publishes an event on this channel

Subscriber:

  • The client connects to the application
  • The interface loads the latest events from the database.
  • The interface opens a website for this particular user who listens to events that can be published.
  • , websocket .

, , , , , .

: PER , ?

:)

+4
1

, , AMQP . .

, , . , ( -). - , .

:

  • . -, websocket.
  • () () , .
  • , .
  • , , , websocket. a guid .

, -. PHP, AMQP . - , . , . .

+1

All Articles