While I cannot give you any direct hint at translating the room concept of Socket.IO to MQTT, you might want to have a look at Mosquitto.js that allows you to easily establish MQTT connections via Websockets from a browser that behave very similarly like real Websockets. With this approach, every open page establishes a unique connection to the MQTT broker. Thus you can even subscribe to different topics depending on some conditions on the client-side.
A little example code:
var mqttSocket = new Mosquitto();
mqttSocket.onconnect = function(rc){
console.log("Connection established");
};
mqttSocket.ondisconnect = function(rc){
console.log("Connection terminated");
};
mqttSocket.onmessage = function(topic, payload, qos){
console.log("Message received " + topic + ":" + payload);
}
mqttSocket.connect("ws://yourserver:8080");
mqttSocket.subscribe('some/topic', 0);
As the native support for Websocket connections is not yet really implemented in any MQTT broker yet, there is a little pice of software required on the server side that bridges the Websocket connection to the MQTT broker.
The developer of Mosquitto.js recommends using a custom mod_websocket module for the Lighttpd webserver for this task. However, as an alternative you might want to try WSS which translates any Websocket connection to an arbitrary other TCP port with minimal overhead
In respect to the example above, you would connect the mqttSocket to the adress and port where an instance of WSS is listening for incoming connections. WSS would then be configured to forward incoming connections to an MQTT broker of your choice.
Disclaimer: WSS has been written by a friend of mine to specifically bridge Mosquitto.js connections to an instance of the Mosquitto MQTT broker.
I hope this helps.