Auto re-subscribe upon re-connect (#340)

* Auto re-subscribe upon re-connect

* Update FIXME

* newHead -> subscribeNewHead in example
This commit is contained in:
Jaco Greeff
2018-10-25 14:45:51 +02:00
committed by Amaury Martiny
parent d2efc664fe
commit 7bfeaa1b20
3 changed files with 41 additions and 10 deletions
@@ -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}`);
});