WsProvider class

The WebSocket Provider allows sending requests using WebSocket to a WebSocket RPC server TCP port. Unlike the [HttpProvider], it does support subscriptions and allows listening to events such as new blocks or balance changes.

Inheritance

Constructors

WsProvider(Uri url, {bool autoConnect = true})
Creates a new websocket connection, connects automatically by default

Properties

hashCode → int
The hash code for this object.
no setterinherited
isOpen → bool
no setter
queries → Map<int, PendingQuery>
Maps the query id to the completer that will resolve the query
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
socket ↔ WebSocket?
WebSocket connection
getter/setter pair
subscriptions → Map<String, StreamController<SubscriptionMessage>>
Maps the subscription id to the stream controller that will emit the subscription data
final
url → Uri
The endpoint url
final

Methods

connect() → Future
Open websocket channel
override
disconnect() → Future
override
getOrCreateSubscriptionController(String subscription, [FutureOr<void> onCancel(String subscription)?]) → StreamController<SubscriptionMessage>
getSubscriptionController(String subscriptionId) → StreamController<SubscriptionMessage>?
isConnected() → bool
override
isReady() → Future<void>
Promise that resolves the first time we are connected and loaded
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(String method, List params) → Future<RpcResponse>
Send arbitrary message to RPC node
override
subscribe(String method, List params, {FutureOr<void> onCancel(String subscription)?}) → Future<SubscriptionResponse>
Send arbitrary message to RPC node
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited