feat: support HTTPS inside websocket (backport #9416) (#9423)

This commit is contained in:
mergify[bot]
2022-09-13 11:13:02 +02:00
committed by GitHub
parent 1b2963e9e6
commit 5164dc6d7d
2 changed files with 6 additions and 2 deletions

View File

@@ -16,6 +16,8 @@
### FEATURES
- [rpc] support https inside websocket (@RiccardoM, @cmwaters)
### IMPROVEMENTS
### BUG FIXES

View File

@@ -89,8 +89,10 @@ func NewWS(remoteAddr, endpoint string, options ...func(*WSClient)) (*WSClient,
if err != nil {
return nil, err
}
// default to ws protocol, unless wss is explicitly specified
if parsedURL.Scheme != protoWSS {
// default to ws protocol, unless wss or https is specified
if parsedURL.Scheme == protoHTTPS {
parsedURL.Scheme = protoWSS
} else if parsedURL.Scheme != protoWSS {
parsedURL.Scheme = protoWS
}