0

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)

  • The error is telling you that `io` is `undefined` so when you do `io.of(...)`, you get `TypeError: Cannot read properties of undefined (reading 'of')`. Nothing else we can offer to help until you include a lot more code so we can see where `io` is supposed to be coming from and how it gets its value. – jfriend00 Feb 19 '22 at 07:39
  • I have added a screenshot of the log for io.of("\") – Salomon Thomas Feb 19 '22 at 12:55
  • People are only going to be able to help you here if you show the relevant portions of your code. Questions about code here on stackoverflow must include the relevant portions of your code pasted into your question as text (no screen shots of code). stackoverflow does not work well for theoretical questions. It works best for questions about actual code where you show the actual code. – jfriend00 Feb 19 '22 at 15:07

0 Answers0