Open ltfschoen opened 5 months ago
@ltfschoen Sorry for being late. Thanks for presenting this library. I haven't done much with websockets yet. I didn't have much time to it before. But I will have more time to work on it next month.
I'll let you know once I start. @ltfschoen
https://x.com/wuminzhe/status/1810555964296413455
@ltfschoen I'm writing the websocket client. I'll update the code after it is ready
WsClient.start('wss://polkadot-rpc.dwellir.com') do |client|
block_hash = client.chain_getBlockHash(100)
runtime_version = client.state_getRuntimeVersion(block_hash)
puts runtime_version
end
WsClient.start('wss://polkadot-rpc.dwellir.com') do |client|
client.chain_subscribeNewHead do |head|
puts head
end
end
@ltfschoen I have added the ws_client and updated the http_client. You can try them by using 0.3.0.
And, I also added an examples dir to show how to use them. I'll add more examples.
@wuminzhe are you going to be maintaining this repo under the Polkadot Tooling Collective?
@wuminzhe @itering recently i presented this repository at a BlockspaceDevRel event as part of Consensus 2024, as I was interested in encouraging its use. Here are the slides https://hackmd.io/@ltfschoen/Hy25QTH40#/. I have a question, is it possible to use this scale_rb library to connect to a local Substrate-based node using Ws instead of Http? If so how? There is a
AbstractWsClient
here https://github.com/wuminzhe/scale_rb/blob/main/lib/client/abstract_ws_client.rb#L6, but could you please share an example of how to use it? Or if the Ws capability is incomplete, do you have any tips on how I could add that capability? Should it be added similar to the deprecated repository https://github.com/itering/substrate_client.rb?tab=readme-ov-file#supported-rpc-methods where it was possible to connect using Ws using:I was only able to connect using Http in my fork of this repo in this example https://github.com/ltfschoen/scale_rb/blob/easya/example01/main.rb#L3 based on reviewing the code in this repository. The reason why I want to connect using Websockets is because most of the available parachain endpoints are Ws endpoints, I'd only use Http for connecting to a Substrate-based node running on localhost.