From 318949a4013504f4ec8931f14bc1b5d6e00dee78 Mon Sep 17 00:00:00 2001 From: jangko Date: Mon, 19 Jul 2021 07:52:57 +0700 Subject: [PATCH] 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. --- json_rpc/clients/websocketclient.nim | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/json_rpc/clients/websocketclient.nim b/json_rpc/clients/websocketclient.nim index 0e9da5b..2f3f7a8 100644 --- a/json_rpc/clients/websocketclient.nim +++ b/json_rpc/clients/websocketclient.nim @@ -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