How to build a chatroom which new channels can be created during server running?


Having read posts about node.js for a long time, I tried to write my own style of chatroom with . Here's the link, but only one channel: Here's what I'm thinking about: Visitors can create new channels by typing title and clicking 'Submit'. Then they can also visit the new channel just like visiting another chatroom. And all these happen while the server is running. I went through the guide on , seems it's hard to create new channels. So is there any simple way via which I can make that?

Problem courtesy of: jiyinyiyong


There's no need to create a channel with the latest version of Socket.IO, the important thing is just to make clients join it, look at this code example on the server side (from the github repo):

var io = require('').listen(80);

io.sockets.on('connection', function (socket) {
  socket.join('justin bieber fans');'justin bieber fans').emit('new fan');'rammstein fans').emit('new non-fan');

As you can see the 'justin bieber fans' channel wasn't created, but clients can join it.

Solution courtesy of: alessioalex


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.