NAME
Net::Async::Blockchain::Client::Websocket - Async websocket Client.
SYNOPSIS
my $loop = IO::Async::Loop->new();
$loop->add(my $ws_source = Ryu::Async->new());
$loop->add(
my $client = Net::Async::Blockchain::Client::Websocket->new(
endpoint => "ws://127.0.0.1:8546",
)
);
$client->eth_subscribe('newHeads')->each(sub {print shift->{hash}})->get;
DESCRIPTION
Auto load the commands as the method parameters for the websocket calls returning them asynchronously.
source
Create an Ryu::Source instance, if it is already defined just return the object
endpoint
Websocket endpoint
URL containing the port if needed
latest_subscription
Latest subscription sent from this module
websocket_client
Create an Net::Async::WebSocket::Client instance, if it is already defined just return the object
configure
Any additional configuration that is not described on IO::Async::Notifier must be included and removed here.
endpoint
_request
Prepare the data to be sent to the websocket and call the request
method
@_
- any parameter required by the RPC call
shutdown
run the configured shutdown action if any
error
error message
eth_subscribe
Subscribe to an event
method
@_
- any parameter required by the RPC call