| 10 | } |
| 11 | |
| 12 | function parseUrl(url) { |
| 13 | var finalUrl = url; |
| 14 | if (finalUrl.startsWith("/")) { // complete absolute paths without scheme only |
| 15 | var basePart = window.location.hostname + (window.location.port ? ':' + window.location.port : ''); |
| 16 | if (window.location.protocol === 'https:') { |
| 17 | finalUrl = "wss://" + basePart + finalUrl; |
| 18 | } else if (window.location.protocol === 'http:') { |
| 19 | finalUrl = "ws://" + basePart + finalUrl; |
| 20 | } |
| 21 | } |
| 22 | return finalUrl; |
| 23 | } |
| 24 | |
| 25 | /** @type {(string | symbol)[]} */ |
| 26 | var PROXY_BLACKLIST = ["then", "catch", "length", "toJSON"]; |