From 9c502a9caef2f7650ab6dfb748215a7570ffd40c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 13 Apr 2022 10:23:06 +0300 Subject: [PATCH] [#179] resolver: Support `wss` connection scheme in `NNS.Dial` WebSocket Secure scheme should also lead to using `neoclient.WSClient` by `NNS`. Signed-off-by: Leonard Lyubich --- ns/nns.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ns/nns.go b/ns/nns.go index 63b205c8..3e7846d1 100644 --- a/ns/nns.go +++ b/ns/nns.go @@ -54,7 +54,8 @@ func (x *neoWebSocket) call(contract util.Uint160, method string, prm []smartcon // Dial connects to the address of the NNS server. If fails, the instance // MUST NOT be used. // -// If URL address scheme is 'ws', then WebSocket protocol is used, otherwise HTTP. +// If URL address scheme is 'ws' or 'wss', then WebSocket protocol is used, +// otherwise HTTP. func (n *NNS) Dial(address string) error { // multiSchemeClient unites neoClient and common interface of // neoclient.Client and neoclient.WSClient. Interface is anonymous @@ -69,7 +70,7 @@ func (n *NNS) Dial(address string) error { } uri, err := url.Parse(address) - if err == nil && uri.Scheme == "ws" { + if err == nil && (uri.Scheme == "ws" || uri.Scheme == "wss") { cWebSocket, err := neoclient.NewWS(context.Background(), address, neoclient.Options{}) if err != nil { return fmt.Errorf("create Neo WebSocket client: %w", err)