Skip to content

Commit

Permalink
fix: respect protocol from browser for manual setup (#3675)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Aug 18, 2021
1 parent 1768d6b commit cdcabb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client-src/utils/createSocketURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function createSocketURL(parsedURL) {
hostname = self.location.hostname;
}

let socketURLProtocol = parsedURL.protocol || "ws:";
let socketURLProtocol = parsedURL.protocol || self.location.protocol;

// When https is used in the app, secure web sockets are always necessary because the browser doesn't accept non-secure web sockets.
if (
Expand Down
2 changes: 1 addition & 1 deletion test/client/utils/createSocketURL.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("'createSocketURL' function ", () => {

["?hostname=%3A%3A", "http://example.com:8080", "ws://example.com:8080/ws"],
["?hostname=%3A%3A1", "http://example.com:8080", "ws://[::1]:8080/ws"],
["?hostname=%3A%3A1", "https://example.com:8080", "ws://[::1]:8080/ws"],
["?hostname=%3A%3A1", "https://example.com:8080", "wss://[::1]:8080/ws"],
[
"?hostname=%3A%3A",
"https://example.com:8080",
Expand Down

0 comments on commit cdcabb2

Please sign in to comment.