Documentation
Docs26. WebSocket Subscriptions

26. WebSocket Subscriptions

The WebSocket server provides live streaming for connected clients. A connection loop manages reader threads autonomously, preventing memory leaks when clients disconnect unexpectedly.

26.1 newHeads

Fires an event every time a new block is finalized (every ~1.5 seconds), pushing the full block header to the client.

26.2 logs

Fires an event when a transaction emits a log matching a specific contract address or event topic. This is the primary method for indexers and dApp frontends to track chain state changes in real-time.