feat: support HTTPS inside websocket (#9416)

This commit is contained in:
Riccardo Montagnin
2022-09-13 10:02:19 +02:00
committed by GitHub
parent dfefd837e7
commit 8e90d294ca

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
}