It appears that with the 0.7 release it will be possible to namespace
sockets, as in the README example:
var chat = io
.of('/chat');
.on('connection', function (socket) {...});
var news = io
.of('/news');
.on('connection', function (socket) {...});
In this case, however, the server expects preset namespaces. My
question is: whether it will be possible to dynamically create
namespaces, for instance, representing the primary key of some object
- an example would be creating one namespace per forum in a message
board app, or one namespace per project in a project management app.
I'm not sure if this is already possible, or how it would best work.
My instinct was to try something like the following before posting
here for help:
Client:
var namespace = 123; // would normally come from url, e.g. /
mysocketpage?id=123
var socket = io.connect('/'+namespace);
Server:
io.sockets.on('connection', function (socket) {
var namespace =
socket.namespace.name;
io.of( namespace ).on('connection', function (socket) {...});
});