Closed tapornanan closed 3 years ago
Hi @tapornanan There are a lot of moving parts and it's really hard to guess what's wrong without seeing the code of both BE and FE parts
I will take a look if create a repo reproducing the issue. Could you do that please?
Thank for your response @probil Here is a repo https://github.com/tapornanan/nest-nuxt-socketio
I am not sure why code above is working but not in my actual project. :(
It was me who emit the joinRoom event inside the middleware which it run on the server side of the nuxt. Moving this code out to execute somewhere on client side solve the problems. 🥂
Thank you
you are welcome @tapornanan It's so nice when the issue closes it self. :)
I have nuxt setup with the vuex store and use userId as a room name.
$socket.emit('joinRoomByUserId', user.id)
// import from socket-instance.jsThen later in my server I emit message back to client
this.socket.in(userId).emit('GAME_RESULT', 'some message');
But my mutation does not receive any message from SOCKET_GAME_RESULT
I already test on https://amritb.github.io/socketio-client-tool/v1 and it work.
I am not sure what I did wrong on my nuxt project.
PS. also I have the others mutations which listen on the broadcast event feed which is work fine. So the only thing that does not work is receive message specificlly by the room name