Subscribe to events
Example event subscription
$ wscat -c wss://eth.chainrpc.io/v3/YOUR-API-KEY
> {"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}Last updated
Subscribe to events with the WebSocket subscription methods.
Subscription is only available over stateful transports such as WebSocket. Subscription requests cannot be made over HTTPS.
The following WebSocket subscription example fires a notification each time a new header is appended to the chain:
$ wscat -c wss://eth.chainrpc.io/v3/YOUR-API-KEY
> {"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}Last updated