Michael Andorfer
Michael Andorfer

Reputation: 1800

How to address specific client/user using a message queue?

I have developed an auction platform with node.js and socket.io.

However, I want to replace the socket.io with a message queue.

While I had no troubles in implementing the sockets based auction platform, I have no idea how to do this with a message queue.

The main thing I don't understand is how to address a specific client/user.

With socket.io I had the socket.id:

io.sockets.connected[socket.id].emit('notify', msg)

How does that work with a message queue like for example Redis Simple Message Queue?

I would be glad if someone could explain me how this works.

Upvotes: 2

Views: 131

Answers (1)

duncanhall
duncanhall

Reputation: 11431

Socket communication and Message Queues are not analogous. Socket.io provides continuous two-way communication between end points (client and server). A message queue provides a way to handle a sequence of items to be processed.

You haven't mentioned why you want to ditch your sockets and replace them with a message queue, but this is unlikely to work.

More likely, you could use a message queue with your socket connection, to pass a sequence of items to other parts of your system. Your socket connection would probably stay exactly as is, and when a message was received on the server, it would be placed into the queue, along with an identifier of the connection that sent it.

Upvotes: 1

Related Questions