We help IT Professionals succeed at work.
Get Started

Join room in another namespace in socket.io

roy wiliams
roy wiliams asked
Last Modified: 2016-09-04
I have this code bellow and it works great in socket.io version 1.3.7

this.gameInfra = io.of('/game_infra');
this.gameInfra.on('connection', (socket) => {

    socket.on('join_room', (room) => {
            var comSocket = self.chatCom.connected[socket.id];
            comSocket.room = room.name;

this.chatCom = io.of('/chat_com');
this.chatCom.on('connection', (socket) => {
    socket.on('message', (message) => {
            message.username = self.gameInfra.connected[socket.id].username;

Open in new window

I want to upgrade my socket.io to the latest version but this code
var comSocket = self.chatCom.connected[socket.id]; 

Open in new window

is undefined in newer versions.

Anyone who nows the new syntax?
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE