Javascript 在RequestIO对象中找不到Express.io文件室函数

Javascript 在RequestIO对象中找不到Express.io文件室函数,javascript,ajax,node.js,socket.io,express.io,Javascript,Ajax,Node.js,Socket.io,Express.io,以下是我试图做的: server.js app = require('express.io')(); app.http().io(); app.get('/', function(req, res) { res.sendfile(__dirname + '/client.html'); }); app.put('/create', function(req, res) { req.io.route('articles'); }); app.io.route('join',

以下是我试图做的:

server.js

app = require('express.io')();
app.http().io();

app.get('/', function(req, res) {
    res.sendfile(__dirname + '/client.html');
});

app.put('/create', function(req, res) {
    req.io.route('articles');
});

app.io.route('join', function(req) {
    req.io.join(req.data);
    req.io.room(req.data).broadcast('newUser', {});
});

app.io.route('articles', function(req) {
    var message = {
        message: 'Article created'
    };
    req.io.room(req.data).broadcast('created', message);
    req.io.respond(message);
});

app.listen(3000);
client.html

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
    io = io.connect();

    io.emit('join','articles');

    io.on('created', function(data) {
        alert(data.message);
    });

    io.on('newUser', function(data) {
        alert('New user');
    });

    $.ajax({
        url: 'http://localhost:3000/create',
        data: 'articles',
        type: 'PUT'
    }).done(function(res) {
        alert('AJAX succeded');
    }).fail(function(res) {
        alert('AJAX failed');
    });
</script>
给出以下错误:

Object #<Object> has no method 'room' at Object.articles
Object#在Object.articles处没有方法“房间”
目标是在向“/created”发出请求后向房间广播消息,而不是向发出请求的客户端广播消息。我使用app.io.room进行广播,但这会发送到所有客户端,包括发出请求的客户端,我不希望这样

所以我的问题是,这是否可以做到,那么我做错了什么,但如果不能做到,那么一点关于为什么不做的信息就好了:)

Object #<Object> has no method 'room' at Object.articles