rpcclient: add Internal client for direct RPC server calls
It has a special `requestF` and a special initialization function, but other than that it's an absolutely regular WSClient. Can be used to call, can be used to subscribe. Fixes #2909.
This commit is contained in:
parent
a55a01d456
commit
6f7fed344b
5 changed files with 239 additions and 46 deletions
18
pkg/rpcclient/local_test.go
Normal file
18
pkg/rpcclient/local_test.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package rpcclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/neorpc"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestInternalClientClose(t *testing.T) {
|
||||
icl, err := NewInternal(context.TODO(), func(ctx context.Context, ch chan<- neorpc.Notification) func(*neorpc.Request) (*neorpc.Response, error) {
|
||||
return nil
|
||||
})
|
||||
require.NoError(t, err)
|
||||
icl.Close()
|
||||
require.NoError(t, icl.GetError())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue