Merge pull request #37 from cnbeining/fix-websocket-wss
Fix WebSocket protocol detecton under HTTPS
This commit is contained in:
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user