Skip to content

Commit f043b52

Browse files
author
Tom Atkinson
committed
Restore support for default port numbers
1 parent 66917d0 commit f043b52

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/WebSocket.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ function initAsClient (address, protocols, options) {
541541

542542
const isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:';
543543
const key = crypto.randomBytes(16).toString('base64');
544+
const port = serverUrl.port || (isSecure ? 443 : 80);
544545
const httpObj = isSecure ? https : http;
545546

546547
//
@@ -559,7 +560,7 @@ function initAsClient (address, protocols, options) {
559560

560561
const requestOptions = {
561562
host: serverUrl.hostname,
562-
port: serverUrl.port,
563+
port,
563564
path: '/',
564565
headers: {
565566
'Sec-WebSocket-Version': options.protocolVersion,

0 commit comments

Comments
 (0)