Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.port && (('wss' === schema && Number(this.port) !== 443) ||
('ws' === schema && Number(this.port) !== 80))) {
port = ':' + this.port;
}
// append timestamp to URI
if (this.timestampRequests) {
query[this.timestampParam] = yeast();
}
// communicate binary support capabilities
if (!this.supportsBinary) {
query.b64 = 1;
}
query = parseqs.encode(query);
// prepend ? to query
if (query.length) {
query = '?' + query;
}
var ipv6 = this.hostname.indexOf(':') !== -1;
return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
};
if (this.port && (('wss' === schema && Number(this.port) !== 443) ||
('ws' === schema && Number(this.port) !== 80))) {
port = ':' + this.port;
}
// append timestamp to URI
if (this.timestampRequests) {
query[this.timestampParam] = yeast();
}
// communicate binary support capabilities
if (!this.supportsBinary) {
query.b64 = 1;
}
query = parseqs.encode(query);
// prepend ? to query
if (query.length) {
query = '?' + query;
}
var ipv6 = this.hostname.indexOf(':') !== -1;
return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
};
Socket.prototype.onopen = function () {
debug('transport is open - connecting');
// write connect packet if necessary
if ('/' !== this.nsp) {
if (this.query) {
var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;
debug('sending connect packet with query %s', query);
this.packet({type: parser.CONNECT, query: query});
} else {
this.packet({type: parser.CONNECT});
}
}
};
if (this.port && (('wss' == schema && this.port != 443)
|| ('ws' == schema && this.port != 80))) {
port = ':' + this.port;
}
// append timestamp to URI
if (this.timestampRequests) {
query[this.timestampParam] = +new Date;
}
// communicate binary support capabilities
if (!this.supportsBinary) {
query.b64 = 1;
}
query = parseqs.encode(query);
// prepend ? to query
if (query.length) {
query = '?' + query;
}
return schema + '://' + this.hostname + port + this.path + query;
};
if (this.port && (('wss' == schema && this.port != 443)
|| ('ws' == schema && this.port != 80))) {
port = ':' + this.port;
}
// append timestamp to URI
if (this.timestampRequests) {
query[this.timestampParam] = +new Date;
}
// communicate binary support capabilities
if (!this.supportsBinary) {
query.b64 = 1;
}
query = parseqs.encode(query);
// prepend ? to query
if (query.length) {
query = '?' + query;
}
return schema + '://' + this.hostname + port + this.path + query;
};
Socket.prototype.onopen = function () {
debug('transport is open - connecting');
// write connect packet if necessary
if ('/' !== this.nsp) {
if (this.query) {
var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;
debug('sending connect packet with query %s', query);
this.packet({type: parser.CONNECT, query: query});
} else {
this.packet({type: parser.CONNECT});
}
}
};
if (this.port && (('wss' == schema && this.port != 443)
|| ('ws' == schema && this.port != 80))) {
port = ':' + this.port;
}
// append timestamp to URI
if (this.timestampRequests) {
query[this.timestampParam] = +new Date;
}
// communicate binary support capabilities
if (!this.supportsBinary) {
query.b64 = 1;
}
query = parseqs.encode(query);
// prepend ? to query
if (query.length) {
query = '?' + query;
}
return schema + '://' + this.hostname + port + this.path + query;
};
if (this.port && (('wss' == schema && this.port != 443)
|| ('ws' == schema && this.port != 80))) {
port = ':' + this.port;
}
// append timestamp to URI
if (this.timestampRequests) {
query[this.timestampParam] = yeast();
}
// communicate binary support capabilities
if (!this.supportsBinary) {
query.b64 = 1;
}
query = parseqs.encode(query);
// prepend ? to query
if (query.length) {
query = '?' + query;
}
var ipv6 = this.hostname.indexOf(':') !== -1;
return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
};
if (this.port && (('wss' == schema && this.port != 443)
|| ('ws' == schema && this.port != 80))) {
port = ':' + this.port;
}
// append timestamp to URI
if (this.timestampRequests) {
query[this.timestampParam] = +new Date;
}
// communicate binary support capabilities
if (!this.supportsBinary) {
query.b64 = 1;
}
query = parseqs.encode(query);
// prepend ? to query
if (query.length) {
query = '?' + query;
}
return schema + '://' + this.hostname + port + this.path + query;
};
r.prototype.uri = function() {
var e = this.query || {}, t = this.secure ? "https" : "http", n = "";
if (false !== this.timestampRequests) {
e[this.timestampParam] = +new Date() + "-" + o.timestamps++
};
this.supportsBinary || e.sid || (e.b64 = 1);
e = i.encode(e);
if (this.port && (t == "https" && this.port != 443 || t == "http" && this.port != 80)) {
n = ":" + this.port
};
if (e.length) {
e = "?" + e
};
return t + "://" + this.hostname + n + this.path + e;
};