SolRengine Realtime
Real-time Solana account monitoring via WebSocket + Turbo Streams. Subscribes to account changes and triggers callbacks when balances update.
Part of the SolRengine framework.
Install
gem "solrengine-realtime"Usage
Configure what happens when an account changes:
# config/initializers/solrengine_realtime.rb
Solrengine::Realtime.on_account_change = ->(wallet_address) {
Rails.cache.delete("wallet/#{wallet_address}/tokens")
portfolio = Solrengine::Tokens::Portfolio.new(wallet_address)
Turbo::StreamsChannel.broadcast_replace_to(
"wallet_#{wallet_address}",
target: "token_list",
partial: "dashboard/token_list",
locals: { tokens: portfolio.tokens }
)
}Run the monitor as a separate process:
# bin/solana_monitor
monitor = Solrengine::Realtime::AccountMonitor.new("Abc...xyz")
monitor.startLicense
MIT