createTransport method

Transport createTransport(
  1. dynamic name, [
  2. dynamic options
])

Creates transport of the given type.

@param {String} transport name @return {Transport} @api private

Implementation

Transport createTransport(name, [options]) {
  _logger.fine('creating transport "$name"');
  var query = Map.from(this.query);

  // append engine.io protocol identifier
  query['EIO'] = parser.protocol;

  // transport name
  query['transport'] = name;

  // per-transport options
  var options = transportOptions[name] ?? {};

  // session id if we already have one
  if (id != null) query['sid'] = id;

  var transport = Transports.newInstance(name, {
    'query': query,
    'socket': this,
    'agent': options['agent'] ?? agent,
    'hostname': options['hostname'] ?? hostname,
    'port': options['port'] ?? port,
    'secure': options['secure'] ?? secure,
    'path': options['path'] ?? path,
    'forceJSONP': options['forceJSONP'] ?? forceJSONP,
    'jsonp': options['jsonp'] ?? jsonp,
    'forceBase64': options['forceBase64'] ?? forceBase64,
    'enablesXDR': options['enablesXDR'] ?? enablesXDR,
    'timestampRequests': options['timestampRequests'] ?? timestampRequests,
    'timestampParam': options['timestampParam'] ?? timestampParam,
    'policyPort': options['policyPort'] ?? policyPort,
//  'pfx: options.pfx || this.pfx,
//  'key: options.key || this.key,
//  'passphrase: options.passphrase || this.passphrase,
//  'cert: options.cert || this.cert,
//  'ca: options.ca || this.ca,
//  'ciphers: options.ciphers || this.ciphers,
//  'rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,
    'perMessageDeflate': options['perMessageDeflate'] ?? perMessageDeflate,
    'extraHeaders': options['extraHeaders'] ?? extraHeaders,
//  'forceNode: options.forceNode || this.forceNode,
//  'localAddress: options.localAddress || this.localAddress,
    'requestTimeout': options['requestTimeout'] ?? requestTimeout,
    'protocols': options['protocols']
  });

  return transport;
}