TriportRPC

net_listening

POSThttps://api.triport.io/v1/polygon

Returns `true` if the node is actively listening for p2p network connections.

Polygonpolygon_read_rpcfree — 15 RPS · basic — 20 RPS · pro — 100 RPS · business — 250 RPS

net_listening reports whether the underlying Polygon node is currently listening for inbound peer-to-peer connections. The result is a single boolean.

In practice a healthy, production node always returns true, so the method is most useful as a lightweight liveness check rather than a source of changing state. It takes no parameters and is available on the free tier.

If you need richer network information, pair this with net_peerCount (number of connected peers) and net_version (the network ID as a decimal string).

Parameters

This method takes no parameters.

optional
Pass an empty array [] as params.

Response

Response fields

FieldTypeDescription
resultbooleantrue when the node is listening for p2p connections. For a healthy node this is effectively always true.

Errors

CodeMeaningWhen it happens
-32001trial_expiredThe API key's trial period has ended; upgrade to a paid tier to continue.
-32002tier_insufficientYour tier is below the level required for this method.
-32003rate_limitedYou exceeded the requests-per-second limit for your tier. Back off and retry after retry_after_sec.
-32004subscription_expiredThe subscription tied to this key has lapsed.
-32005unauthorizedThe API key is missing, malformed, or lacks the polygon_read_rpc scope.
-32601method_unknownThe method name is not recognized on this network.

Errors are returned in the standard JSON-RPC envelope. See the shared errors reference for the full error object shape and handling guidance.

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io/v1/polygon", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "net_listening",
    params: [],
  }),
});


const { result } = await res.json();
console.log(result);   // true

TypeScript SDK (@triport/sdk)

import { Triport } from "@triport/sdk";


const client = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });


const listening = await client.polygon.rpc<boolean>("net_listening", []);
console.log(listening);   // true

Python (triport-sdk)

import os
from triport import Triport


client = Triport(api_key=os.environ["TRIPORT_API_KEY"])


listening = client.polygon.rpc("net_listening", [])
print(listening)   # True

Notes

  • The result is a plain boolean, not a hex quantity — no decoding is required.
  • A false result from a healthy production endpoint is not expected; treat it as a signal that the node is degraded rather than as routine state.
  • Because the value rarely changes, there is little benefit to polling it at high frequency. Use it as an occasional health-ping, not a per-request gate.
  • Related network-info methods: net_version and net_peerCount.