Polygon Websocket (JSON-RPC PubSub)

Stream real-time Polygon blockchain data using WebSocket subscriptions. Get instant notifications for new blocks, pending transactions, and smart contract events without polling.

🚀

Quick Start

Ready to start streaming Polygon data? Our WebSocket endpoint provides real-time access to on-chain events with minimal setup.

👉 Check Polygon WebSocket Reference


What is Polygon WebSocket?

Polygon WebSocket interface implements the JSON-RPC 2.0 PubSub specification, enabling your application to receive real-time notifications over a persistent bidirectional connection. Instead of repeatedly polling RPC endpoints for updates, the server pushes events to your client the moment they occur on-chain.

Key features:

  • Low latency: Block header notifications arrive within seconds of chain confirmation
  • Server-side filtering: Subscribe to specific event types blocks, pending transactions, or contract logs with topic filters
  • Full JSON-RPC over WebSocket: Execute any standard eth_* RPC method over the same connection used for subscriptions
  • Auto-cleanup: Subscriptions close when the connection drops

Best for:

  • Block explorers and real-time dashboards
  • Mempool monitoring and gas price tracking
  • Smart contract event streaming (ERC-20 transfers, DEX swaps, NFT mints)
  • Transaction confirmation tracking
  • MEV and gas optimization strategies
  • Wallet notifications and balance updates

Supported Subscription Methods

Tatum's Polygon WebSocket endpoint supports the full eth_subscribe / eth_unsubscribe specification with 3 subscription types plus full JSON-RPC access over the same connection:

Subscription Types

SubscriptionDescriptionUse Case
newHeadsNew block headers as they are minedBlock explorers, gas tracking, chain monitoring
newPendingTransactionsTransaction hashes entering the mempoolMempool dashboards, MEV monitoring, gas estimation
logsFiltered event logs from smart contractsToken transfers, DEX swaps, NFT activity, protocol events

JSON-RPC Methods Over WebSocket

In addition to subscriptions, you can call any standard Polygon JSON-RPC method over the same WebSocket connection. This eliminates the need for a separate HTTP connection:

MethodDescription
eth_getBlockByNumberFetch full block data with transactions
eth_getTransactionByHashLook up transaction details by hash
eth_getTransactionReceiptGet transaction receipt with logs and status
eth_getBalanceQuery account balance
eth_callExecute a read-only smart contract call
eth_getCodeGet contract bytecode
eth_getLogsQuery historical event logs
eth_gasPriceGet current gas price estimate
eth_blockNumberGet latest block number
net_versionGet network ID
...and most other standard eth_* methodsSee unsupported methods for exceptions
ℹ️

WebSocket + RPC on One Connection

Polygon's WebSocket endpoint supports both subscriptions and standard RPC calls on the same connection. This means you can subscribe to newHeads, then immediately call eth_getBlockByNumber to fetch full block details all over a single WebSocket.

Not Supported

MethodStatusWhy
syncing subscription❌ Not supportedNot available on Tatum's infrastructure. The eth_syncing RPC call is also not supported.
eth_syncing RPC call❌ Not supportedReturns Method not found. Tatum nodes are fully synced; sync status is not exposed.
eth_newFilter / eth_getFilterChanges❌ Not supportedStateful filter methods. Use eth_subscribe with logs for real-time events, or eth_getLogs for historical queries. See why Tatum does not support eth_newFilter.
ℹ️

Workaround for Unsupported Methods

For syncing: Tatum nodes are fully synced and maintained sync status monitoring is not needed. If your application requires a health check, use eth_blockNumber to verify the node is returning current blocks.

For eth_newFilter: Use eth_subscribe with logs for real-time event streaming, or eth_getLogs for historical log queries. Both are more scalable and better suited for production workloads.


Connection

Connect to the Polygon WebSocket endpoint with your API key:

Supported networks:

  • Mainnet: wss://polygon-mainnet.gateway.tatum.io/{API_KEY}
ℹ️

Testnet WebSocket Availability

WebSocket connections are currently available for Polygon Mainnet only. Testnet support HTTP RPC but do not expose WebSocket endpoints at this time. Use HTTP RPC for testnet development and WebSocket for mainnet production workloads.


WebSocket vs. HTTP Polling

FeatureWebSocketHTTP Polling
ProtocolPersistent WS connectionRepeated HTTP requests
LatencyReal-time push (~0ms after node processes)Poll interval dependent (1s–15s typical)
BandwidthEfficient (events only)Wasteful (many empty responses)
ComplexityModerate (connection management)Simple (stateless requests)
Mempool accessnewPendingTransactions❌ Not available
Event streaminglogs subscription with filters❌ Must poll eth_getLogs
Best forDashboards, real-time UIs, event-driven backendsSimple scripts, serverless functions, one-off queries

Recommendation:

  • Use WebSocket for: real-time dashboards, block explorers, mempool monitoring, event-driven architectures.
  • Use HTTP RPC for: serverless functions, one-off queries, simple scripts, environments where persistent connections aren't possible.



Did this page help you?