docs: function(url, newSchemeBase, subPath) {                                                       // 18
    if (! newSchemeBase) {                                                                                          // 19
      newSchemeBase = "http";                                                                                       // 20
    }                                                                                                               // 21
                                                                                                                    // 22
    var ddpUrlMatch = url.match(/^ddp(i?)\+sockjs:\/\//);                                                           // 23
    var httpUrlMatch = url.match(/^http(s?):\/\//);                                                                 // 24
    var newScheme;                                                                                                  // 25
    if (ddpUrlMatch) {                                                                                              // 26
      // Remove scheme and split off the host.                                                                      // 27
      var urlAfterDDP = url.substr(ddpUrlMatch[0].length);                                                          // 28
      newScheme = ddpUrlMatch[1] === "i" ? newSchemeBase : newSchemeBase + "s";                                     // 29
      var slashPos = urlAfterDDP.indexOf('/');                                                                      // 30
      var host =                                                                                                    // 31
            slashPos === -1 ? urlAfterDDP : urlAfterDDP.substr(0, slashPos);                                        // 32
      var rest = slashPos === -1 ? '' : urlAfterDDP.substr(slashPos);                                               // 33
                                                                                                                    // 34
      // In the host (ONLY!), change '*' characters into random digits. This                                        // 35
      // allows different stream connections to connect to different hostnames                                      // 36
      // and avoid browser per-hostname connection limits.                                                          // 37
      host = host.replace(/\*/g, function () {                                                                      // 38
        return Math.floor(Random.fraction()*10);                                                                    // 39
      });                                                                                                           // 40
                                                                                                                    // 41
      return newScheme + '://' + host + rest;                                                                       // 42
    } else if (httpUrlMatch) {                                                                                      // 43
      newScheme = !httpUrlMatch[1] ? newSchemeBase : newSchemeBase + "s";                                           // 44
      var urlAfterHttp = url.substr(httpUrlMatch[0].length);                                                        // 45
      url = newScheme + "://" + urlAfterHttp;                                                                       // 46
    }                                                                                                               // 47
                                                                                                                    // 48
    // Prefix FQDNs but not relative URLs                                                                           // 49
    if (url.indexOf("://") === -1 && !startsWith(url, "/")) {                                                       // 50
      url = newSchemeBase + "://" + url;                                                                            // 51
    }                                                                                                               // 52
                                                                                                                    // 53
    // XXX This is not what we should be doing: if I have a site                                                    // 54
    // deployed at "/foo", then DDP.connect("/") should actually connect                                            // 55
    // to "/", not to "/foo". "/" is an absolute path. (Contrast: if                                                // 56
    // deployed at "/foo", it would be reasonable for DDP.connect("bar")                                            // 57
    // to connect to "/foo/bar").                                                                                   // 58
    //                                                                                                              // 59
    // We should make this properly honor absolute paths rather than                                                // 60
    // forcing the path to be relative to the site root. Simultaneously,                                            // 61
    // we should set DDP_DEFAULT_CONNECTION_URL to include the site                                                 // 62
    // root. See also client_convenience.js #RationalizingRelativeDDPURLs                                           // 63
    url = Meteor._relativeToSiteRootUrl(url);                                                                       // 64
                                                                                                                    // 65
    if (endsWith(url, "/"))                                                                                         // 66
      return url + subPath;                                                                                         // 67
    else                                                                                                            // 68
      return url + "/" + subPath;                                                                                   // 69
  }