Sha256: 564f022378874e51828974c2acf87b76a67ed4128de4ead406c113f082cd26f7

Contents?: true

Size: 456 Bytes

Versions: 8

Compression:

Stored size: 456 Bytes

Contents

require 'scale_rb'

# You can have multiple subscriptions at the same time
ScaleRb::WsClient.start('wss://polkadot-rpc.dwellir.com') do |client|
  client.chain_subscribeNewHead do |head|
    puts "Received new head at height: #{head[:number].to_i(16)}"
  end

  client.state_subscribeStorage do |storage|
    block_hash = storage[:block]
    changes = storage[:changes]
    puts "Received #{changes.size} storage changes at block: #{block_hash}"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
scale_rb-0.5.1 examples/ws_client_2.rb
scale_rb-0.5.0 examples/ws_client_2.rb
scale_rb-0.4.2 examples/ws_client_2.rb
scale_rb-0.4.1 examples/ws_client_2.rb
scale_rb-0.4.0 examples/ws_client_2.rb
scale_rb-0.3.5 examples/ws_client_2.rb
scale_rb-0.3.4 examples/ws_client_2.rb
scale_rb-0.3.3 examples/ws_client_2.rb