diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 4a5832ad4..1038e12a9 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -16,6 +16,8 @@ ### FEATURES +- [rpc] support https inside websocket (@RiccardoM, @cmwaters) + ### IMPROVEMENTS ### BUG FIXES diff --git a/rpc/jsonrpc/client/ws_client.go b/rpc/jsonrpc/client/ws_client.go index 09b41888f..5a4839b04 100644 --- a/rpc/jsonrpc/client/ws_client.go +++ b/rpc/jsonrpc/client/ws_client.go @@ -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 }