Client:
var table_id = 1; // example, python will give this value
var socket = io('http://localhost:3000/table'+table_id');
socket.on('connect', function() {
console.log('Connected');
socket.emit('join', "table_"+table_id);
});
Server:
var nsp = [io.of('/table1'), io.of('/table2')];
for(key in nsp){
nsp[key].on('connection', function(socket){
socket.on('join', function(table) {
console.log('joined to table '+table);
});
socket.on('message', function(message) {
nsp[key].emit('hi', 'everyone!');
});
});
}