Overview of Geth Real-time Events (PubSub)
Geth (v1.4+) supports a publish/subscribe model using JSON-RPC notifications. This allows clients to subscribe to specific events and receive notifications containing relevant data and a subscription ID, eliminating the need for polling.
Key Constraints:
- Connection Type: Requires a full-duplex connection, such as WebSockets or IPC (enabled by default).
- Lifecycle: Subscriptions are tied to the connection; if the connection closes, all associated subscriptions are removed.
- Data Scope: Notifications are sent for current events only, not historical events.
- Buffer Limits: Notifications are stored in an internal buffer. If the client cannot keep up and the buffer reaches the limit (currently 10k), the connection is closed.