Skip to content

Commit c2c840d

Browse files
authored
Merge pull request #38 from INFURA/subscription_fixes
fixes to websocket subscription docs
2 parents cf95154 + f9ecff2 commit c2c840d

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

docs/gettingStarted/usefulLinks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
- [IPFS API documentation](https://ipfs.io/docs/api/)
55
- [Ethereum Pub/Sub API documentation](https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB)
66
- [Parity Ethereum Pub/Sub API documentation](https://wiki.parity.io/JSONRPC-Parity-Pub-Sub-module.html)
7+
- [Parity Pub/Sub API documentation](https://wiki.parity.io/JSONRPC-Eth-Pub-Sub-Module)

docs/wss/eth_subscribe.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
11
# eth_subscribe
22

33
Creates a new subscription over particular events. The node will return a subscription id. For each event that matches the subscription a notification with relevant data is send together with the subscription id.
4-
NOTE: eth_unsubscribe is only supported on geth nodes (Mainnet, Ropsten, Rinkeby networks)
54

65
### REQUEST PARAMS
76
- `SUBSCRIPTION TYPE NAME` _[required]_
87
- `newHeads`- Subscribing to this, fires a notification each time a new header is appended to the chain, including chain reorganizations. Users can use the bloom filter to determine if the block contains logs that are interested to them.
98
- `logs` - Returns logs that are included in new imported blocks and match the given filter criteria. In case of a chain reorganization previous sent logs that are on the old chain will be resend with the removed property set to true. Logs from transactions that ended up in the new chain are emitted. Therefore a subscription can emit logs for the same transaction multiple times.
10-
- `address` - either an address or an array of addresses. Only logs that are created from these addresses are returned (optional)
11-
- `topics` - only logs which match the specified topics (optional)
12-
- `syncing` - Indicates when the node starts or stops synchronizing. The result can either be a boolean indicating that the synchronization has started (true), finished (false) or an object with various progress indicators.
9+
- `address` (optional) - either an address or an array of addresses. Only logs that are created from these addresses are returned (optional)
10+
- `topics` (optional) - only logs which match the specified topics (optional)
1311
- `newPendingTransactions` - Returns the hash for all transactions that are added to the pending state and are signed with a key that is available in the node. When a transaction that was previously part of the canonical chain isn't part of the new canonical chain after a reogranization its again emitted.
14-
- `OPTIONAL ARGUMENTS`
15-
- `includeTransactions` - A flag indicating to whether include transactions in the response
12+
- `syncing` - Indicates when the node starts or stops synchronizing. The result can either be a boolean indicating that the synchronization has started (true), finished (false) or an object with various progress indicators. NOT SUPPORTED ON KOVAN!
1613

1714
#### EXAMPLE
1815
```bash
1916
>wscat -c wss://mainnet.infura.io/ws
2017

2118
// newHeads
22-
>{"id": 1, "method": "eth_subscribe", "params": ["newHeads", {"includeTransactions": true}]}
19+
>{"id": 1, "method": "eth_subscribe", "params": ["newHeads"]}
2320

2421
// logs
2522
>{"id": 1, "method": "eth_subscribe", "params": ["logs", {"address": "0x8320fe7702b96808f7bbc0d4a888ed1468216cfd", "topics": ["0xd78a0cb8bb633d06981248b816e7bd33c2a35a6089241d099fa519e361cab902"]}]}
2623

2724
// newPendingTransactions
2825
>{"id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}
2926

30-
// syncing
27+
// syncing (not supported on Kovan)
3128
>{"id": 1, "method": "eth_subscribe", "params": ["syncing"]}
3229
```
3330

@@ -97,7 +94,7 @@ NOTE: eth_unsubscribe is only supported on geth nodes (Mainnet, Ropsten, Rinkeby
9794
}
9895
}
9996

100-
// syncing subscription
97+
// syncing subscription (not supported on Kovan)
10198
{
10299
"subscription":"0xe2ffeb2703bcf602d42922385829ce96",
103100
"result": {

docs/wss/eth_unsubscribe.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# eth_unsubscribe
22

33
Subscriptions are cancelled with a regular RPC call with eth_unsubscribe as method and the subscription id as first parameter. It returns a bool indicating if the subscription was cancelled successful.
4-
NOTE: eth_unsubscribe is only supported on geth nodes (Mainnet, Ropsten, Rinkeby networks)
54

65
### REQUEST PARAMS
76
- `SUBSCRIPTION ID` _[required]_

docs/wss/faq.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,11 @@ Any unrecognized requests will trigger the server to close the connection with a
2929

3030
web3.js 1.0.0-beta.34 has an open issue with request headers https://github.com/ethereum/web3.js/issues/1559. Please revert/downgrade to 1.0.0-beta.33.
3131

32+
**Why is includeTransactions option not working for eth_subscribe?**
33+
34+
Though the includeTransactions option is included in the Ethereum Pub/Sub API documentation, currently it is not returning the expected results.
35+
For more information: https://github.com/ethereum/go-ethereum/issues/15804.
36+
37+
38+
3239

docs/wss/parity_subscribe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# parity_subscribe
22

33
Starts a subscription (on WebSockets / IPC / TCP transports) to results of calling some other RPC method. For every change in returned value of that RPC call a JSON-RPC notification with result and subscription ID will be sent to a client.
4-
NOTE: parity_unsubscribe is only supported on parity nodes (Kovan network)
4+
NOTE: parity_subscribe is only supported on the Kovan network
55

66
### REQUEST PARAMS
77
- `RPC method name` _[required]_

docs/wss/parity_unsubscribe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# parity_unsubscribe
22

33
Unsubscribes from a subscription.
4-
NOTE: parity_unsubscribe is only supported on parity nodes (Kovan network)
4+
NOTE: parity_unsubscribe is only supported on the Kovan network
55

66
### REQUEST PARAMS
77
- `SUBSCRIPTION ID` _[required]_

0 commit comments

Comments
 (0)