net_listening - Celo
This method returns true if the client is actively listening for network connections on the Celo network.
Parameters
- None
Request Example
curl
bashcurl -X POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "net_listening",
"params": []
}'index.js
javascriptconst axios = require('axios');
const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/';
const payload = {
jsonrpc: '2.0',
id: 'getblock.io',
method: 'net_listening',
params: []
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));example.py
pythonimport requests
import json
url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"
payload = {
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "net_listening",
"params": []
}
response = requests.post(url, headers={"Content-Type": "application/json"}, json=payload)
print(response.json())Response Example
json{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": true
}Response Definition
| Field | Type | Description |
|---|---|---|
| result | boolean | true if listening |
Use Cases
- Check node connectivity
- Health monitoring
- Network diagnostics
Error Handling
| Error Code | Description |
|---|---|
| -32603 | Internal error |