0

It seems simple to me, but if haven't figured out how or if it is doable with socket.io. I want to send a message to sockets which are in multiple rooms

io.to(['room-1', 'room-2']).emit()

io.to('room-1').to('room-2').emit()

both versions send messages to sockets either in room-1 and/or room-2, but i would like to send this message only to sockets which are in both rooms.

I saw this question, but it is fairly old and used socket.io v1. I was wondering if there is a more recent solution to this problem. socket.io broadcast only to users who are in room A and B

Is there a way to achieve this?

warly
  • 1,458
  • 1
  • 16
  • 21

0 Answers0