rpc: add a note to RPC clients about thread-safeness

This commit is contained in:
Anna Shaleva 2022-02-22 16:49:38 +03:00 committed by AnnaShaleva
parent 2896c0a83a
commit 1f255e756f
2 changed files with 4 additions and 1 deletions

View file

@ -28,7 +28,8 @@ const (
) )
// Client represents the middleman for executing JSON RPC calls // Client represents the middleman for executing JSON RPC calls
// to remote NEO RPC nodes. // to remote NEO RPC nodes. Client is thread-safe and can be used from
// multiple goroutines.
type Client struct { type Client struct {
cli *http.Client cli *http.Client
endpoint *url.URL endpoint *url.URL

View file

@ -22,6 +22,8 @@ import (
// servers. It's supposed to be faster than Client because it has persistent // servers. It's supposed to be faster than Client because it has persistent
// connection to the server and at the same time is exposes some functionality // connection to the server and at the same time is exposes some functionality
// that is only provided via websockets (like event subscription mechanism). // that is only provided via websockets (like event subscription mechanism).
// WSClient is thread-safe and can be used from multiple goroutines to perform
// RPC requests.
type WSClient struct { type WSClient struct {
Client Client
// Notifications is a channel that is used to send events received from // Notifications is a channel that is used to send events received from