socketio / socket.io-redis-emitter

The Socket.IO Redis emitter, allowing to communicate with a group of Socket.IO servers from another Node.js process.
https://socket.io/docs/v4/redis-adapter/
MIT License
722 stars 121 forks source link

What is the difference between Socket.io Redis adapter and Redis emitter #111

Closed amjedomar closed 2 years ago

amjedomar commented 2 years ago

While I'm reading this article from the Socket.io documentation

I found that the following two packages @socket.io/redis-adapter and @socket.io/redis-emitter are used to emit data to the clients that are on the other servers.

Are these two packages different? And if yes what is the difference? And when to use one instead of the other?

amjedomar commented 2 years ago

The answer to this question exists on StackOverflow: https://stackoverflow.com/questions/71578212/what-is-the-difference-between-socket-io-redis-adapter-and-redis-emitter/71602798#71602798

darrachequesne commented 2 years ago

Hi! There is a diagram in the documentation explaining the duties of each package:

image

Source: https://socket.io/docs/v4/adapter/

The adapter is a component inside the Socket.IO server, while the emitter can be used in another process/service.

If you find something that is not clear enough, please ping me. Thanks!

amjedomar commented 2 years ago

Thanks, @darrachequesne for the answer.

I have spent hours to figuring the difference between the two. I know the difference seems quite easy to notice but I was confused the first time.

I had already answered my question that I asked at StackOverflow: https://stackoverflow.com/questions/71578212/what-is-the-difference-between-socket-io-redis-adapter-and-redis-emitter/71602798#71602798

But I liked your answer as it is very short.

The adapter is a component inside the Socket.IO server, while the emitter can be used in another process/service.

So I quoted it and added it to my answer at StackOverflow to help future people know the difference.