Skip to content
This repository was archived by the owner on Jan 22, 2018. It is now read-only.
This repository was archived by the owner on Jan 22, 2018. It is now read-only.

Connections number and subscribing to events #5

Open
@wnz99

Description

@wnz99

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.

  1. 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?

  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions