From 75a5b6588dec5b3802825ef18eeff78754b88510 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 12 Apr 2022 11:19:32 +0300 Subject: [PATCH] [#179] resolver: Use `Client` with `WSClient` in `NNS` WebSocket client (`WSClient` type) from Neo Go library shows better performance than HTTP one (`Client` type). Signed-off-by: Leonard Lyubich --- resolver/nns.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resolver/nns.go b/resolver/nns.go index fea728d..48db64c 100644 --- a/resolver/nns.go +++ b/resolver/nns.go @@ -29,16 +29,16 @@ type NNS struct { } // client is a core implementation of internal NNS.neoClient which is used by NNS.Dial. -type client neoclient.Client +type client neoclient.WSClient func (x *client) invoke(contract util.Uint160, method string, prm []smartcontract.Parameter) (*result.Invoke, error) { - return (*neoclient.Client)(x).InvokeFunction(contract, method, prm, nil) + return (*neoclient.WSClient)(x).InvokeFunction(contract, method, prm, nil) } // Dial connects to the address of the NNS server. If fails, the instance // SHOULD NOT be used. func (n *NNS) Dial(address string) error { - cli, err := neoclient.New(context.Background(), address, neoclient.Options{}) + cli, err := neoclient.NewWS(context.Background(), address, neoclient.Options{}) if err != nil { return fmt.Errorf("create neo client: %w", err) }