I don't get any response from json-rpc
subscription.
It seems I need a type
paramater, but the provider.subscribe()
method does not document the type
parameter. (I checked the js, java and python code, can't find any explanation of this param).
const { WsProvider } = require('@polkadot/api');
(async () => {
const provider = new WsProvider('wss://kusama-rpc.polkadot.io');
var count = 0
const type = '' // @param string <==== what should this be?
const method = 'chain_subscribeAllHeads'
// const method = 'subscribeAllHeads' // => method not found
// const method = 'state_subscribeRuntimeVersion'
const params = []
const unsub = await provider.subscribe(type, method, params, (err, response) => {
count++
console.log(err, response)
if(count > 2) {
unsub()
process.exit(0)
}
})
})()