Skip to content
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

Issue with socketsJoin #502

Open
dalda95 opened this issue May 23, 2023 · 0 comments
Open

Issue with socketsJoin #502

dalda95 opened this issue May 23, 2023 · 0 comments

Comments

@dalda95
Copy link

dalda95 commented May 23, 2023

Migrating from remoteJoin to use the socketsJoin i have notice a strange behavior, seems that the socketsJoin method is not waiting for a response from others server so that if we perform an emit after a socketJoin the added socket is not receiving the message

Notice: the socketId1 maybe is connected to another server


io.in(socketId1).socketsJoin(room1)
io.to(room1).emit('my-event', payload)

in that case the socketId1 is not receiving the message, i saw the code and in the past version the remoteJoin was a Promise so i imagine that the function is waiting for a response, but now i think that is not waiting causing a problem, maybe i miss something, but if i add in the middle a simple fetchSockets it start to work

io.in(socketId1).socketsJoin(room1)
await io.in(room1).fetchSockets() // also sometimes it not return the socketId1
io.to(room1).emit('my-event', payload)

if i add a:

io.in(socketId1).socketsJoin(room1)
io.to(room1).emit('my-event', payload)


setTimeout(async() => {
     await io.in(room1).fetchSockets() // in that case it return always the socketId
}, 1000)

can you please help me to understand the problem here ?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant