Subscribe to events

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.

Example event subscription

The following WebSocket subscription example fires a notification each time a new header is appended to the chain:
$ wscat -c wss://
> {"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newHeads"]}