Infura开发手册

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

parity_subscribe

启动一个Websockets/IPC/TCP传输层之上的订阅来调用其他RPC方法。

请求参数

请求参数对象结构如下:

  • rpc方法名
  • rpc方法参数数组

API请求

>wscat -c wss://kovan.infura.io/ws

// subscribe to eth_getBalance
>{"jsonrpc":"2.0", "id":1, "method":"parity_subscribe", "params":["eth_getBalance",["0x004702bdcC3C7dbFfd943136107E70B827028600", "latest"]]}

API响应

// New Subscription response
{
    "jsonrpc": "2.0",
    "result": "0x070fa1c4d1b3fd81",
    "id": 1
}

// eth_getBalance subscription notification
{
    "jsonrpc":"2.0",
    "method":"parity_subscription",
    "params": {
        "result":"0x36464dbbdd98953718",
        "subscription":"0x49a3a64111acb418"
    }
}

返回一个字符串,表示新创建的订阅ID。