Merge pull request #37 from cnbeining/fix-websocket-wss

Fix WebSocket protocol detecton under HTTPS
This commit is contained in:
Marco
2023-02-19 13:14:12 +01:00
committed by GitHub

View File

@@ -74,7 +74,8 @@ export function toFormatArgs(codes: string[]): string {
} }
export function getWebSocketEndpoint() { export function getWebSocketEndpoint() {
return `ws://${localStorage.getItem('server-addr') || window.location.hostname}:${localStorage.getItem('server-port') || window.location.port}/ws-rpc` const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
return `${protocol}://${localStorage.getItem('server-addr') || window.location.hostname}:${localStorage.getItem('server-port') || window.location.port}/ws-rpc`
} }
export function getHttpRPCEndpoint() { export function getHttpRPCEndpoint() {