- OpenEthereum
- Setup OpenEthereum
- Beginner Introduction
- Frequently Asked Questions
- Usage and Config
- Technical Documentation
- Pluggable Consensus
- Aura - Authority Round
- Proof-of-Authority Chains
- Demo PoA-Tutorial
- Private Development Chain
- Transaction Queue
- Warp Sync (par)
- Warp Sync Snapshot Format
- Code flow
- Secret Store
- Permissioning
- WebAssembly (Deprecated)
- JSON RPC API
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
The parity_pubsub Module
JSON-RPC methods
JSON-RPC API Reference
parity_subscribe
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.
Below examples use wscat
, a simple command line WebSockets client. Find out how to install and use it by visiting wscat GitHub repository.
An example notification received by subscribing to eth_getBalance
RPC method:
{"jsonrpc":"2.0","method":"parity_subscription","params":{"subscription":"0x416d77337e24399d","result":["0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826"]}}
You can unsubscribe using parity_unsubscribe
RPC method. Subscriptions are also tied to a transport connection, disconnecting causes all subscriptions to be canceled.
Parameters
String
- RPC method nameArray
- Parameters passed to RPC method. (Optional, defaults to no parameters)
params: [
"eth_getBalance",
[
"0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826",
"latest"
]
]
Returns
String
- Assigned subscription ID
Example
Request
wscat -c localhost:8546
>{"method":"parity_subscribe","params":["eth_getBalance",["0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826","latest"]],"id":1,"jsonrpc":"2.0"}
Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x416d77337e24399d"
}
parity_unsubscribe
Unsubscribes from a subscription.
Parameters
String
- Subscription ID
params: ["0x416d77337e24399d"]
Returns
Boolean
- whether the call was successful
Example
Request
wscat -c localhost:8546
>{"method":"parity_unsubscribe","params":["0x416d77337e24399d"],"id":1,"jsonrpc":"2.0"}
Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论