一段时间后,我又尝试使用node.js和socket.IO进行工作,但结果并不如预期:
我的设置
- Downloaded node.js from github and compiled it on my external webserver running on debian squeeze
- Created a directory for the node.js project
- Added socket.io locally with npm
Created socketIO_server.js and just added this single line of code:
var socketIO = require('socket.io').listen(8000);
Started the socketIO_server.js and console log says "info - socket.io started"
- Opening http://domain.tld:8000 gives the message "welcome to socket.io"
问题
当我尝试访问客户端库(http://domain.tld:8000/socket.io/socket.io.js)时,会显示"welcome to socket.io"的消息,但是控制台日志显示"served static content /socket.io.js"。我不知道这是为什么!我认为是并行运行的nginx服务器造成了这个问题,但是停止服务器并没有改变什么。
感谢您的阅读和帮助!
.on('request')
处理程序。https://github.com/LearnBoost/socket.io/blob/master/lib/manager.js#L115 - travis