2014-05-03 55 views
0
var io = require('socket.io').listen(80); 

io.sockets.on('connection', function (socket) { 
socket.on('set nickname', function (name) { 
socket.set('nickname', name, function() { 
socket.emit('ready'); 
}); 
}); 

socket.on('msg', function() { 
socket.get('nickname', function (err, name) { 
    console.log('Chat message by ', name); 
}); 
}); 
}); 

雖然運行此代碼我得到一個錯誤:如何在ecllipse中安裝nodejs的socket.io插件?

Cannot find module 'socket.io'.

我怎樣才能解決這個問題?

回答

0

截至目前,沒有eclipse集成可用於Node.js及其依賴項或模塊。您需要下載rpm或deb build並將其安裝到您的系統上。

請參考:Install node.js modules in eclipse