Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

verify if room exists in socket.io

if (io.sockets.adapter.rooms.has(roomIdentifier]) {
  socket.join(roomIdentifier);
} else {
  console.log(socket.id + 'tried to join ' + roomIdentifier + 'but the room does not exist.');
  // Socket.join is not executed, hence the room not created.
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #verify #room #exists
ADD COMMENT
Topic
Name
8+9 =