The logsSubscribe
method in Solana allows developers to receive real-time notifications about new log messages on the Solana blockchain. This subscription-based method provides updates whenever new logs are generated.
filter
- An object or string specifying the type of logs to receive:
"all"
- Subscribe to all logs (string){mentions: [<string>]}
- An array of public keys as base-58 encoded strings. Returns notifications only when the specified account or program ID is mentioned in the log.<commitment>
- (optional) The level of commitment desired when querying state. Default is “finalized”.
result
- An integer subscription id (needed to unsubscribe)
subscription
- An object containing log information:
signature
- The transaction signature as base-58 encoded stringerr
- Error if transaction failed, null if transaction succeededlogs
- Array of string log messageslogsSubscribe
code examplesThis example subscribes to all logs from the pump.fun program.
Note that subscriptions require a WebSocket connection and WebSocket cat for you to use this method in the console.
Install WebSocket cat with:
npm install -g wscat
The logsSubscribe
method in Solana is used to subscribe to the network and receive real-time updates on new log messages. This can be useful in various real-world scenarios, including:
By subscribing to the logsSubscribe
method, applications can receive instant updates about new log messages, allowing them to react quickly to events on the Solana blockchain and provide a more responsive user experience.
The logsSubscribe
method in Solana allows developers to receive real-time notifications about new log messages on the Solana blockchain. This subscription-based method provides updates whenever new logs are generated.
filter
- An object or string specifying the type of logs to receive:
"all"
- Subscribe to all logs (string){mentions: [<string>]}
- An array of public keys as base-58 encoded strings. Returns notifications only when the specified account or program ID is mentioned in the log.<commitment>
- (optional) The level of commitment desired when querying state. Default is “finalized”.
result
- An integer subscription id (needed to unsubscribe)
subscription
- An object containing log information:
signature
- The transaction signature as base-58 encoded stringerr
- Error if transaction failed, null if transaction succeededlogs
- Array of string log messageslogsSubscribe
code examplesThis example subscribes to all logs from the pump.fun program.
Note that subscriptions require a WebSocket connection and WebSocket cat for you to use this method in the console.
Install WebSocket cat with:
npm install -g wscat
The logsSubscribe
method in Solana is used to subscribe to the network and receive real-time updates on new log messages. This can be useful in various real-world scenarios, including:
By subscribing to the logsSubscribe
method, applications can receive instant updates about new log messages, allowing them to react quickly to events on the Solana blockchain and provide a more responsive user experience.