New Here? Claim Your 30% Discount on Your First Blockchain Node Access!

banner image

Last updated on January 1, 1970

2 min read

Method subscribe undefined ()
connect with WS protocol

subscribe

info-circle-fill

Used to subscribe to a particular service.

Parameters

ConstractsFilter - array of string

optional

array of contract addresses

SubscribeEvent - boolean

optional

subscribe to events if true

SubscribeJsonBlock - boolean

optional

subscribe to json blocks if true

SubscribeRawBlock - boolean

optional

subscribe to raw blocksif true

SubscribeBlockTxHashs - boolean

optional

subscribe to transaction hashes if true

Request

wscat -c wss://ont.getblock.io/YOUR-API-KEY/mainnet/ 
# wait for connection and send the request body 
{'Action': 'subscribe', 'Version': '1.0.0', 'Id': 1, 'SubscribeJsonBlock': True, 'SubscribeRawBlock': True}

Response

{
    "Action": "subscribe",
    "Desc": "SUCCESS",
    "Error": 0,
    "Id": 1,
    "Result": {
        "ContractsFilter": null,
        "SubscribeBlockTxHashs": false,
        "SubscribeEvent": false,
        "SubscribeJsonBlock": true,
        "SubscribeRawBlock": true
    },
    "Version": "1.0.0"
}
banner icon

Start Building with GetBlock RPCs for Free