You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/web3-eth-subscribe.rst
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,7 @@ Returns
38
38
- ``on("data")`` returns ``Object``: Fires on each incoming log with the log object as argument.
39
39
- ``on("changed")`` returns ``Object``: Fires on each log which was removed from the blockchain. The log will have the additional property ``"removed: true"``.
40
40
- ``on("error")`` returns ``Object``: Fires when an error in the subscription occurs.
41
+
- ``on("connected")`` returns ``Number``: Fires once after the subscription successfully connected. Returns the subscription id.
41
42
42
43
----------------
43
44
Notification returns
@@ -189,6 +190,7 @@ Returns
189
190
190
191
- ``"data"`` returns ``Object``: Fires on each incoming block header.
191
192
- ``"error"`` returns ``Object``: Fires when an error in the subscription occurs.
193
+
- ``"connected"`` returns ``Number``: Fires once after the subscription successfully connected. Returns the subscription id.
192
194
193
195
The structure of a returned block header is as follows:
194
196
@@ -230,6 +232,9 @@ Example
230
232
231
233
console.error(error);
232
234
})
235
+
.on("connected", function(subscriptionId){
236
+
console.log(subscriptionId);
237
+
})
233
238
.on("data", function(blockHeader){
234
239
console.log(blockHeader);
235
240
})
@@ -340,6 +345,7 @@ Returns
340
345
- ``"data"`` returns ``Object``: Fires on each incoming log with the log object as argument.
341
346
- ``"changed"`` returns ``Object``: Fires on each log which was removed from the blockchain. The log will have the additional property ``"removed: true"``.
342
347
- ``"error"`` returns ``Object``: Fires when an error in the subscription occurs.
348
+
- ``"connected"`` returns ``Number``: Fires once after the subscription successfully connected. Returns the subscription id.
343
349
344
350
For the structure of a returned event ``Object`` see :ref:`web3.eth.getPastEvents return values <eth-getpastlogs-return>`.
0 commit comments