WsEndpoint class

WebSocket endpoint for real-time blockchain updates

Constructors

WsEndpoint(FailoverProxy _proxyInterface, {required WsConfig config})

Properties

autoReconnect bool
getter/setter pair
config WsConfig
final
connected Completer<void>?
Completer for connection state (package-private for FailoverProxy access)
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
manuallyClosed bool
Whether the connection was manually closed (package-private for FailoverProxy access)
getter/setter pair
onConnect ↔ void Function()?
Called when a connection has been established
getter/setter pair
onEnd ↔ void Function()?
Called when the WebSocket is closed
getter/setter pair
onError ↔ void Function(Object error)?
Called when an error occurs with the WebSocket
getter/setter pair
onMessage ↔ void Function(WsMsgClient)?
Called when a message is received from the WebSocket
getter/setter pair
onReconnect ↔ void Function(Object error)?
Called before a reconnection attempt is made
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subs WsSubscriptions
final
ws ↔ WebSocketChannel?
WebSocket connection (package-private for FailoverProxy access)
getter/setter pair

Methods

close() → void
Close the WebSocket connection and prevent any future reconnection attempts
handleMsg(List<int> msgData) Future<void>
Handle incoming WebSocket messages
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
Pause the WebSocket connection by disabling auto-reconnect and closing the connection. Useful when the app is backgrounded to save resources.
resume() Future<void>
Resume the WebSocket connection by re-enabling auto-reconnect and reconnecting if the connection is closed. Useful when the app comes to foreground.
subscribeToAddress(String address) → void
Subscribe to an address Method can be used for p2pkh or p2sh addresses
subscribeToBlocks() → void
Subscribe to block messages
subscribeToLokadId(String lokadId) → void
Subscribe to a lokadId
subscribeToPlugin(String pluginName, String group) → void
Subscribe to a plugin
subscribeToScript(ScriptType type, String payload) → void
Subscribe to the given script type and payload For "p2pkh", scriptPayload is the 20 byte public key hash
subscribeToTokenId(String tokenId) → void
Subscribe to a tokenId
subscribeToTxid(String txid) → void
Subscribe to a txid
subscribeToTxs() → void
Subscribe to all tx messages
toString() String
A string representation of this object.
inherited
unsubscribeFromAddress(String address) → void
Unsubscribe from the given address
unsubscribeFromBlocks() → void
Unsubscribe from block messages
unsubscribeFromLokadId(String lokadId) → void
Unsubscribe from the given lokadId
unsubscribeFromPlugin(String pluginName, String group) → void
Unsubscribe from the given plugin
unsubscribeFromScript(ScriptType type, String payload) → void
Unsubscribe from the given script type and payload
unsubscribeFromTokenId(String tokenId) → void
Unsubscribe from the given tokenId
unsubscribeFromTxid(String txid) → void
Unsubscribe from the given txid
unsubscribeFromTxs() → void
Unsubscribe from all tx messages
waitForOpen() Future<void>
Wait for the WebSocket to be connected

Operators

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