Open
Description
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