logsUnsubscribe – Solana
The logsUnsubscribe JSON-RPC method allows clients to unsubscribe from receiving transaction log notifications.
The logsUnsubscribe RPC Solana method cancels an active logs subscription using its subscription ID.
Once unsubscribed, the client will no longer receive notifications about transaction logs.
Supported Networks
Mainnet
Devnet
Parameters
Required Parameter
integer
(required): The subscription ID for the logs subscription to cancel.
Result
The response returns a boolean value indicating whether the unsubscribe operation was successful.
Result Format
bool
:true
if the unsubscribe was successful; otherwise,false
.
Request Example
API Endpoints
JSON-RPC Request
Response
A successful request returns a boolean value.
Example Response
In this response:
result
:true
indicates the unsubscribe operation was successful.
Error Handling
Common logsUnsubscribe error scenarios:
Invalid subscription ID: The provided ID does not correspond to an active subscription.
Network issues: Problems with the Solana JSON-RPC API endpoints.
Example Error Response
Use Cases
The Solana logsUnsubscribe method is essential for:
Managing network resources by terminating unused subscriptions.
Optimizing dApp performance.
Reducing network bandwidth consumption.
Code logsUnsubscribe Example – Web3 Integration
Integration with Web3
By integrating Web3 logsUnsubscribe into Solana's Core API, developers can efficiently manage subscription lifecycles, improve dApp performance, and optimize network resource utilization.
Last updated