I am using socket.io and am looking for a way for the client to be able to specify which room it would like to connect to, but I can't figure out a good way to make this happen.
On the server I have:
io.sockets.on 'connection', (socket)->
console.log 'A socket connected.'
socket.join('my_room')
On the client I have:
io = io.connect("http://domain.com")
What I would like to do is get some initial state in the first connection on the client so that the server knows which room it should try and connect the person to.
So something like this on the client:
io = io.connect("http://domain.com", room_1)
Then the server would have some thing like this:
io.sockets.on 'connection', (socket, data)->
console.log 'A socket with connected!'
socket.join(data)
Is this possible to do with room? Is there a better way? I looked into namespaces but rooms more closely fit what I am trying to do.