io.of ('Namespace'). emit ('Ereignis', Nachricht) funktioniert nicht mit Namespace in socket.io

Ich habe eine App wie diese:

io.of('/hello').on('connection', function(socket) {
    socket.emit('world', {});
});

app.post('/', function *(next) {
    console.log("At here......");
    var pushMessage = (yield parse.json(this));
    console.log(pushMessage);
    if(flag !== 0) {
//        io.of('/hello/').emit('world', pushMessage);
        io.sockets.emit('world', pushMessage);
    } else {
        console.log("Do Nothing");
    }
});

Es erhält eine http-Anfrage und sendet ein Ereignis. Wenn ich io.sockets.emit verwende, funktioniert es gut, aber wenn ich mit 'io.of' ('hello') einen Namespace spezifiziere. Emit 'funktioniert es nicht, warum?

Meine Kundenseite ist diese:

var socket = io.connect('http://localhost:3000', {
  'reconnection delay': 100,
  'reconnection limit': 100,
  'max reconnection attempts': 10
});
//server side use io.sockets.emit
socket.on('world', function(data) {
  alert(data.a);
});

//if server side use io.of('/hello/').emit
//socket.of('/hello/').on('world', function(data) {
//  alert(data.a);
//});

Antworten auf die Frage(1)

Ihre Antwort auf die Frage