net_listening
https://api.triport.io/v1/polygonReturns `true` if the node is actively listening for p2p network connections.
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[] as params.Response
Response fields
| Field | Type | Description |
|---|---|---|
result | boolean | true when the node is listening for p2p connections. For a healthy node this is effectively always true. |
Errors
| Code | Meaning | When it happens |
|---|---|---|
-32001 | trial_expired | The API key's trial period has ended; upgrade to a paid tier to continue. |
-32002 | tier_insufficient | Your tier is below the level required for this method. |
-32003 | rate_limited | You exceeded the requests-per-second limit for your tier. Back off and retry after retry_after_sec. |
-32004 | subscription_expired | The subscription tied to this key has lapsed. |
-32005 | unauthorized | The API key is missing, malformed, or lacks the polygon_read_rpc scope. |
-32601 | method_unknown | The 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); // trueTypeScript 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); // truePython (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) # TrueNotes
- The result is a plain boolean, not a hex quantity — no decoding is required.
- A
falseresult 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_versionandnet_peerCount.