Module: SolanaRuby::WebSocketMethods::SlotMethods

Included in:
SolanaRuby::WebSocketClient
Defined in:
lib/solana_ruby/web_socket_methods/slot_methods.rb

Overview

Slot Related Web Socket Methods

Instance Method Summary collapse

Instance Method Details

#on_slot_change(&block) ⇒ Object

Subscribe to slot change notifications. Options can include parameters such as commitment level, encoding, etc.



9
10
11
12
# File 'lib/solana_ruby/web_socket_methods/slot_methods.rb', line 9

def on_slot_change(&block)
  # Default to empty params if no options are provided.
  subscribe("slotSubscribe", [], &block)
end

#remove_slot_change_listener(subscription_id) ⇒ Object

Unsubscribe from slot change notifications.



15
16
17
# File 'lib/solana_ruby/web_socket_methods/slot_methods.rb', line 15

def remove_slot_change_listener(subscription_id)
  unsubscribe("slotUnsubscribe", subscription_id)
end