Subscriptions | Polygon

Subscriptions are a feature of the Polygon JSON-RPC API that allows developers to receive real-time updates on various blockchain events. Developers can subscribe to specific events of interest, such as new block headers, pending transactions, or contract events.

📘

Note that all subscriptions require a WebSocket connection.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Native EVM subscriptions

Developers can use the following native methods to subscribe to events:

The subscriptions created can be cleared using the following method:

web3.js subscriptions

The web3.js library also offers subscription methods. web3.js subscriptions are the successors of the deprecated web3.eth.filter methods and provide a way for developers to receive real-time updates about events on the blockchain without constantly polling the blockchain for new data.

Subscriptions can be created using one of the following methods:

The subscriptions created can be cleared using the following method: