1

モジュール「socket.io」と「connect」を使用する単純なアプリケーションをHerokuにデプロイしようとしています。アプリケーションをデプロイすると、Permission Deniedエラーが発生し、アプリケーションがクラッシュします。環境プロパティ「PORT」からポート番号を取得しています。WebSocketではなく長いポーリングを使用するようにsocket.ioを構成しています(サポートされていないことがわかっています)。

誰かが私が間違っていることを教えてもらえますか?

     var io = require('socket.io'),
        connect = require('connect');

    var port = process.env.PORT || 5000;


    var app = connect().use(connect.static('public')).listen(port);
    var chat_room = io.listen(app);


    chat_room.configure(function () {
        chat_room.set("transports", ["xhr-polling"]);
        chat_room.set("polling duration", 10);
    });

chat_room.sockets.on('connection', function(socket){
    socket.emit('entrance', {message:'Welcome to the chat room.'});
    socket.on('disconnect', function(){
         chat_room.sockets.emit('exit', {message:'A chatter has disconnected.'});
     });

     socket.on('chat', function(data){
        chat_room.sockets.emit('chat',{message: '# ' + data.message});
     });
     chat_room.sockets.emit('entrance', {message: 'A new chatter is online.'});
 });

ログからのエラーは次のとおりです。

2013-02-01T04:24:04+00:00 app[web.1]: Error: EACCES, Permission denied
2013-02-01T04:24:04+00:00 app[web.1]:     at Server.listen (net.js:1063:20)
2013-02-01T04:24:04+00:00 app[web.1]: node.js:134
2013-02-01T04:24:04+00:00 app[web.1]:     at Server._doListen (net.js:1098:5)
2013-02-01T04:24:04+00:00 app[web.1]:     at net.js:1069:14
2013-02-01T04:24:04+00:00 app[web.1]:     at Object.lookup (dns.js:153:45)
2013-02-01T04:24:04+00:00 app[web.1]:     at Object.listen (/app/node_modules/socket.io/lib/socket.io.js:67:12)
2013-02-01T04:24:04+00:00 app[web.1]:     at Object.<anonymous> (/app/main.js:8:20)
2013-02-01T04:24:04+00:00 app[web.1]:     at Module.load (module.js:336:31)
2013-02-01T04:24:04+00:00 app[web.1]:     at Module._compile (module.js:404:26)
2013-02-01T04:24:04+00:00 app[web.1]:     at Function._load (module.js:297:12)
2013-02-01T04:24:04+00:00 app[web.1]:     at Object..js (module.js:410:10)
2013-02-01T04:24:06+00:00 heroku[web.1]: Process exited with status 1
2013-02-01T04:24:06+00:00 heroku[web.1]: State changed from starting to crashed

ありがとう!

4

0 に答える 0