当我将clientWS连接到ServerWS时,即使没有启动ServerWS,我也会遇到socket.io-client normaly的问题。它尝试连接循环。
我在一个简单的节点应用程序中尝试过它,但是当我试图将它包含在另一个项目中时,我收到了这个错误:
.../node_modules/socket.io-client/lib/manager.js:75
this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
^
TypeError: Cannot call method 'apply' of undefined
at Manager.emitAll (.../node_modules/socket.io-client/lib/manager.js:75:25)
at null._onTimeout (.../node_modules/socket.io-client/lib/manager.js:464:12)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
16 Mar 21:54:03 - [nodemon] app crashed - waiting for file changes before starting...
两个项目中的连接代码相同:
var socket = require("socket.io-client");
var ws = socket("http://localhost:3000");
所以我不知道问题是什么......
(使用socket.io和socket.io-client 1.3.5测试)