Skip to content

Commit

Permalink
Add clause for checking ws in https
Browse files Browse the repository at this point in the history
  • Loading branch information
OmniTroid committed Nov 22, 2023
1 parent 1e56d09 commit f848f34
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions webAO/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ fpPromise
}
}

if (window.location.protocol === "https:" && connectionString.startsWith("ws://")) {
// If protocol is https: and connectionString is ws://
// We have a problem, since it's impossible to connect to ws:// from https://
// Connection will fail, but at least warn the user
alert('Attempted to connect using insecure websockets on https page. Please try removing s from https:// in the URL bar.')
}

client = new Client(connectionString);
client.connect()
isLowMemory();
Expand Down

0 comments on commit f848f34

Please sign in to comment.