net_listening - Somnia
Example code for the net_listening JSON-RPC method. Complete guide on how to use net_listening JSON-RPC in GetBlock Web3 documentation
This method returns true if the client is actively listening for network connections on the Somnia network.
Parameters
None
Request Example
curl -X POST https://go.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "net_listening",
"params": []
}'const axios = require('axios');
const payload = {
jsonrpc: '2.0',
id: 'getblock.io',
method: 'net_listening',
params: []
};
axios.post('https://go.getblock.io/<ACCESS-TOKEN>/', payload)
.then(response => console.log(response.data));import requests
payload = {
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "net_listening",
"params": []
}
response = requests.post("https://go.getblock.io/<ACCESS-TOKEN>/", json=payload)
print(response.json())Response Example
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": true
}Use Cases
Node health checks
Connection validation
Monitoring node status
Last updated
Was this helpful?