Connections number and subscribing to events #5
Description
Apologies it this is not the right place to ask, but I have looked at the available documentation and could not figure out myself. I am also new to js programming.
I have two questions.
- Once the api is initiated with:
const transport = new Api.Provider.Http(HttpsUrl, timeout);
const api = new Api(transport);
the browser stars doing http JSON POST requests to my remote RPC Parity server to the method net_listening
every timeout
seconds. Which is the correct way to destroy api
to stop this polling?
- Upon subscription to an event, such as:
api.subscribe('eth_blockNumber', this.onNewBlockNumber)
the browser starts to send POST requests every second.
Upon unsubscription:
api.unsubscribe(subscriptionID)
these requests keep going on. Is this an expected behaviour? I am unsubscribing to events when unmounting react components. Ideally I would like the api to stop doing those requests in order to minimize the load and bandwidth on the Parity node.
Thank you for any help