eth_subscribeWebSocket

Creates a connection-scoped WebSocket subscription for new events. Reconnects require a new subscription and historical backfill; supported event types depend on the selected upstream.

Chain EthereumTransport WSTry-it ws docs

How to use

  1. Open a WebSocket to the chain WS endpoint with your key in the path.
  2. Copy the wscat example below into your terminal.
  3. Requires a persistent WebSocket — not a one-shot HTTP POST.

Parameters

JSON-RPC positional arguments — order matches the array sent in params. Index badges below match array positions.

typeStringrequired

Subscription type string. Common values: "newHeads", "logs", "newPendingTransactions".

Allowed
newHeadslogsnewPendingTransactions
filterObjectoptional

Only for logs: address and topics filters. This is not the full eth_getLogs filter: subscriptions do not query a historical fromBlock/toBlock range. Use eth_getLogs for backfill.

params array (shape)

eth_subscribe · paramsjson
1[
2 "newHeads"
3]

Response fields

The result row describes the complete result; other rows describe its object fields or array elements. Indented rows describe nested members. For subscriptions,params.* rows describe later notifications rather than the initial reply.

FieldTypeDescription
resultDATASubscription id; subsequent notifications reference it.
params.subscriptionDATASubsequent eth_subscription notifications identify this subscription; notifications have no request id.
params.resultOBJECT|DATANotification payload: header for newHeads, log object for logs, or transaction hash for a supported pending-transaction subscription. New events can be duplicated or reorganized.