Provider based on WS JSON-RPC requests.
Creates a new instance of the WebSocket Provider
baseURLstring the WS URL of the noderequestTimeoutnumber the timeout for the WS request (in MS)
new WSProvider('ws://test3.gno.land:36657/ws');
// provider with WS connection is createdCloses the WS connection. Required when done working with the WS provider
const wsProvider = new WSProvider('ws://test3.gno.land:36657/ws');
wsProvider.closeConnection();
// WS connection is now closedSends a request to the WS connection, and resolves upon receiving the response
requestRPCRequest the RPC request
Returns Promise<RPCResponse<Result>>
const request: RPCRequest = // ...
const wsProvider = new WSProvider('ws://test3.gno.land:36657/ws');
wsProvider.sendRequest<Result>(request);
// request is sent over the open WS connectionParses the result from the response
responseRPCResponse<Result> the response to be parsed
Returns Result
const response: RPCResponse = // ...
const wsProvider = new WSProvider('ws://test3.gno.land:36657/ws');
wsProvider.parseResponse<Result>(response);
// response is parsedWaits for the WS connection to be established
Returns Promise<null>
const wsProvider = new WSProvider('ws://test3.gno.land:36657/ws');
await wsProvider.waitForOpenConnection()
// status of the connection is: CONNECTED