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?
The short answer from Damien — a core committer of Socket.io
And there are two diagrams in the documentation explaining the duties of each package
The long answer
They are pretty similar with the following two differences:
@socket.io/redis-adaptersocket.ioserver, And you must provide it a publish and subscribe redis client. like the following:socket.iocommands to/from other servers.@socket.io/redis-emittersocket.ioserver, And you must provide it a publish redis client. like the following:socket.iocommands to the other servers (that has@socket.io/redis-adapteradapter with the same redis database connection and channel key configuration)Note: These differences applies to all socket.io adapters and emitters (e.g.
@socket.io/mongo-adapterand@socket.io/mongo-emitter)