Skip to content

Commit cdcabb2

Browse files
fix: respect protocol from browser for manual setup (#3675)
1 parent 1768d6b commit cdcabb2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

client-src/utils/createSocketURL.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function createSocketURL(parsedURL) {
2121
hostname = self.location.hostname;
2222
}
2323

24-
let socketURLProtocol = parsedURL.protocol || "ws:";
24+
let socketURLProtocol = parsedURL.protocol || self.location.protocol;
2525

2626
// When https is used in the app, secure web sockets are always necessary because the browser doesn't accept non-secure web sockets.
2727
if (

test/client/utils/createSocketURL.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe("'createSocketURL' function ", () => {
5555

5656
["?hostname=%3A%3A", "http://example.com:8080", "ws://example.com:8080/ws"],
5757
["?hostname=%3A%3A1", "http://example.com:8080", "ws://[::1]:8080/ws"],
58-
["?hostname=%3A%3A1", "https://example.com:8080", "ws://[::1]:8080/ws"],
58+
["?hostname=%3A%3A1", "https://example.com:8080", "wss://[::1]:8080/ws"],
5959
[
6060
"?hostname=%3A%3A",
6161
"https://example.com:8080",

0 commit comments

Comments
 (0)