fixes ws rpc client bug: error when trying to connect to infura

fixes #109

previously, if using uri such as "wss://mainnet.infura.io/ws/v3/infura-id",
the client will throw error. this bug already fixed in nim-websock,
now this also fixed in json-rpc. it works when connected to infura wss.
This commit is contained in:
jangko 2021-07-19 07:52:57 +07:00
parent a138c410c5
commit 318949a401
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
1 changed files with 3 additions and 9 deletions

View File

@ -78,16 +78,10 @@ proc connect*(client: RpcWebSocketClient, uri: string,
else:
@[]
let uri = parseUri(uri)
let secure = uri.scheme == "wss"
let port = parseInt(uri.port)
let ws = await WebSocket.connect(
host = uri.hostname,
port = Port(port),
path = uri.path,
secure=secure,
flags=flags,
factories=ext
uri=uri,
factories=ext,
flags=flags
)
client.transport = ws
client.uri = uri