Auto re-subscribe upon re-connect (#340)
* Auto re-subscribe upon re-connect * Update FIXME * newHead -> subscribeNewHead in example
This commit is contained in:
committed by
Amaury Martiny
parent
d2efc664fe
commit
7bfeaa1b20
@@ -10,7 +10,7 @@ async function main () {
|
||||
// Subscribe to the new headers on-chain. The callback is fired when new headers
|
||||
// are found, the call itself returns a promise with a subscription that can be
|
||||
// used to unsubscribe from the newHead subscription
|
||||
const subscriptionId = await api.rpc.chain.newHead((header) => {
|
||||
const subscriptionId = await api.rpc.chain.subscribeNewHead((header) => {
|
||||
console.log(`best #${header.blockNumber}`);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user