code: function(event) {
              event = event || {code: 1000};
              _cometd._debug('WebSocket onclose', context, event, 'connecting', _connecting, 'current', _context);
  
              if (context.connectTimer) {
                  self.clearTimeout(context.connectTimer);
              }
  
              self.onClose(context, event);
          }
docs: This callback is invoked when the server sends the close frame. The close frame for a connection may arrive *after* another connection has been opened, so we must make sure that actions are performed only if it's the same connection.