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.join(room.name);
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;
socket.in(socket.room).broadcast.send(JSON.stringify(message));
});
});
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?