K
K
Kirill_chaklidi2021-05-06 19:34:01
Node.js
Kirill_chaklidi, 2021-05-06 19:34:01

How to pass data from Redis event to socket.join() method?

Hello. I am writing a chat for a project using laravel redis and socket.io. The logic should be such that when I have ioredis on the node server, it catches the redis event and from there it should pull out an object with the room id and pass it to the socket.join (room) method to create a room. But the point is that I can’t put the pmessage event handler in the socke.io connection handler, because if I do that, the pmessage event will be hung every time someone connects, but I can’t remove the connection handler either, since I need the one passed in this socket handler to run the socket.join method. I looked through thousands of articles and couldn't find an answer. Do not tell me how to make it so that I would not create a new handler every time and the id transfer would work correctly. Thanks in advance

60941a76adcd2618610357.jpeg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question