-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createAdapter(pubClient, subClient) breaks subClient.connect(): "Error: Cannot send commands in PubSub mode" #436
Comments
Hmm it seems to work if I move the
Is this intentional? If yes, the documentation should be updated to reflect this. |
Hi! Unfortunately, I wasn't able to reproduce the issue. Could it be linked to redis/node-redis@ac808ea? |
Hi! I got the same issue when deploying my app on a cloud provider. I had to move the |
It seems the clients must be connected before creating the adapter. Related: #436
OK, so I've updated the README and the documentation on the website: https://socket.io/docs/v4/redis-adapter/ Thanks for the heads-up! |
@darrachequesne You need to update this page as well, I was stuck here for ages lol. https://socket.io/docs/v4/server-api/#serveradaptervalue const pubClient = createClient({ And // redis@4 |
package.json
The Redis itself is running in Docker with the image
redis:6.2.6-alpine3.15
.Here is the code that doesn't work for some reason:
The code gives me the following error:
If I remove the line
io.adapter(createAdapter(pubClient, subClient))
, it starts working again:If I remove the
subClient.connect()
, but leave the adapter, it doesn't crash, but I obviously won't receive the published messages:Do I just need to downgrade some packages or why might I have this problem? It feels like the README is using outdated packages, as an example, the Redis
createClient
now takes theurl
option instead of thehost
andport
mentioned in the README.The text was updated successfully, but these errors were encountered: