code: function() {
      // choose from the sub-protocols
      if (typeof self.options.handleProtocols == 'function') {
        var protList = (protocols || '').split(/, */);
        var callbackCalled = false;
        self.options.handleProtocols(protList, function(result, protocol) {
          callbackCalled = true;
          if (!result) abortConnection(socket, 401, 'Unauthorized');
          else completeHybiUpgrade2(protocol);
        });
        if (!callbackCalled) {
          // the handleProtocols handler never called our callback
          abortConnection(socket, 501, 'Could not process protocols');
        }
        return;
      } else {
        if (typeof protocols !== 'undefined') {
          completeHybiUpgrade2(protocols.split(/, */)[0]);
        }
        else {
          completeHybiUpgrade2();
        }
      }
    }
docs: optionally call external protocol selection handler before calling completeHybiUpgrade2