CNode

我是小白,问个关于socket.io的小白问题啊啊

Kkfeng123发布于12 年前最后回复12 年前4 回复3551 浏览0 收藏

就是看官网上给出的聊天室例子,的确照着弄成功了。可是详细看代码时,发现index.html里都有这么一句:

这个应该是在客户端里读入socket.io.js。

然后我的问题是,这个src的地址不对啊,我看来看去,在我的服务器上都没有这么个文件啊!我觉得应该是node_modules/socket.io/socket.io.js啊,为什么少了个node_modules?可是却执行的好好的,我是不是错过了什么?

查看回复

回复 (4)

T
think2011#1·12 年前

估计跟express的路由机制一样的原理吧,看起来像是访问了 xxx.js ,实际上真实路径是 xxx/xxx/xxx/xxx.js

J
jiyinyiyong#2·12 年前

确实是 socket.io 在服务器是做了手脚... 文件是 socket.io-client/socket.io.js https://github.com/Automattic/socket.io/blob/master/lib/index.js#L248 https://github.com/Automattic/socket.io/blob/master/lib/index.js#L28

T
tolerious#4·12 年前

Mark

参与回复
登录后即可参与回复。登录