Javascript 无法连接到socket.io两次

Javascript 无法连接到socket.io两次,javascript,node.js,coffeescript,socket.io,mocha.js,Javascript,Node.js,Coffeescript,Socket.io,Mocha.js,我已经编写了一个socket.io服务器,我正在使用mocha来测试它。但我无法在第二次连接到服务器 这是我的代码,是用咖啡脚本写的 服务器: 测试: 服务器输出: 摩卡咖啡产量: Socket ◦ 应连接:未定义 ✓ 应连接(75毫秒) 使用者 1) 应该连接 1传球(2秒) 1失败 1) 用户应连接到: 错误:超过2000毫秒的超时时间 在空。(/home/wangbin/webapp/chat_server/node_modules/mocha/lib/runnable.js:165:14

我已经编写了一个
socket.io
服务器,我正在使用
mocha
来测试它。但我无法在第二次连接到服务器

这是我的代码,是用咖啡脚本写的

服务器: 测试: 服务器输出: 摩卡咖啡产量:
Socket
◦ 应连接:未定义
✓ 应连接(75毫秒)
使用者
1) 应该连接
1传球(2秒)
1失败
1) 用户应连接到:
错误:超过2000毫秒的超时时间
在空。(/home/wangbin/webapp/chat_server/node_modules/mocha/lib/runnable.js:165:14)
at Timer.listOnTimeout[as onttimeout](timers.js:110:15)

当您要创建新会话时,请为.connect方法设置“强制新连接”选项

io.connect(socketAddress,{'force new connection': true});

对于任何使用1.0代码行的人,该标志已更改为“forceNew”:true遇到了相同的问题。谢谢
chai = require 'chai'
io = require 'socket.io-client'

should = chai.should()

describe 'Socket', ()->

  url = 'http://0.0.0.0:3000'

  it 'should be connected', (done) ->
    client = io.connect(url)
    client.on 'connect', (data) ->
      console.log(data)
      client.socket.connected.should.equal(true)
      client.disconnect()
      done()


describe 'User', ()->

  url = 'http://0.0.0.0:3000'

  it 'should be connected', (done) ->
    client = io.connect(url)
    client.on 'connect', (data) ->
      console.log(data)
      client.socket.connected.should.equal(true)
      client.disconnect()
      done()
   info  - socket.io started
   debug - client authorized
   info  - handshake authorized b_2h4dCr-YfD-7-Iw9Hl
   debug - setting request GET /socket.io/1/websocket/b_2h4dCr-YfD-7-Iw9Hl
   debug - set heartbeat interval for client b_2h4dCr-YfD-7-Iw9Hl
   debug - client authorized for 
   debug - websocket writing 1::
b_2h4dCr-YfD-7-Iw9Hl
   debug - got disconnection packet
   info  - transport end by forced client disconnection
   debug - websocket writing 0::
   info  - transport end (booted)
   debug - set close timeout for client b_2h4dCr-YfD-7-Iw9Hl
   debug - cleared close timeout for client b_2h4dCr-YfD-7-Iw9Hl
   debug - cleared heartbeat interval for client b_2h4dCr-YfD-7-Iw9Hl
   debug - discarding transport
  Socket
    ◦ should be connected: undefined
    ✓ should be connected (75ms)

  User
    1) should be connected


  1 passing (2 seconds)
  1 failing

  1) User should be connected:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/wangbin/webapp/chat_server/node_modules/mocha/lib/runnable.js:165:14)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
io.connect(socketAddress,{'force new connection': true});