'TypeError on socket.io adapter

For using multiple nodes in my socket.io as part of expanding I used the Redis socket.io adapter @socket.io/redis-adapter. The transmission of data/messages between sockets on different nodes works fine on the cluster mode. When trying to fetch the rooms list by using the below command io.of("/").adapter.rooms. I got a type error with the following message

TypeError Cannot read properties of undefined (reading 'of') TypeError: Cannot read properties of undefined (reading 'of')

But I got the data

Map(2) { 'j6tCnsyjjzFBpbNuAAAB' => Set(1) { 'j6tCnsyjjzFBpbNuAAAB' }, 'books' => Set(1) { 'j6tCnsyjjzFBpbNuAAAB' } }

I was confused as am getting the room data but this type error continues.

The response for printing io console.log(io)

console.log(io)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source