在关注创建聊天服务的教程时遇到此错误。这是代码:(大部分是自动生成的)
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
var io = require('socket.io').listen(app.listen(port));
io.sockets.on('connection', function (socket) {
socket.emit('message', { message: 'welcome to the chat' });
socket.on('send', function (data) {
io.sockets.emit('message', data);
});
});
客户方:
script(src='/javascripts/chat.js')
script(src='/socket.io/socket.io.js')
我是否真的必须手动将socket.io.js放入文件夹?我不明白......