如何确定socket.io正在工作?

通常情况下,为了知道它已经启动,在Node中有一条消息说“info – socket.io started”。 但是,由于某种原因,我没有得到它。 可能是一个版本的东西。

那么还有另一种方法可以知道我的套接字是否启动并正在监听?

你最近更新了Socket.io从0.9版本到1.x吗? 日志报告的默认值随版本1.0而改变,并且默认情况下较为冗长。
请参阅升级文档。

PS:如果你升级了Socket.io,你甚至没有意识到,那是因为你的“package.json”文件没有locking版本。 我强烈build议反对使用*作为版本:总是更具体, 至lesslocking到次要版本的版本(根据每个semver )。 例如:

 // In package.json, under "dependencies": // NOT SAFE: this always gets the last version, which may have some breaking change (as per semver, with version XYZ, changes in X allow breaking changes in APIs) "socket.io": "*" // POSSIBLY SAFE: this does not update to the new major version, so API compatibility *should* be always maintained (however, it's not 100% safe too, to be used carefully) "socket.io": "1.x" // SAFE: this allows updates that contain bug fixes and minor additions; API-compatibility should always be guaranteed "socket.io": "1.0.x" "socket.io": "1.0.*" // equivalent "socket.io": "~1.0.4" // equivalent