Due to the huge volume of data for order book events and tickers, please use the following dedicated URLs when subscribing to these type of data.
|Any other subscription||wss://ws.web3api.io|
In order to establish a connection between client and server an initial http handshake is required. This is known as subscribing. Subscription requests are performed using JSON-RPC, similar to Geth and Parity.
All subscriptions follow the same pattern, let's first cover what all websocket subscription endpoints share in common before diving into the types of subscriptions and their response formats. To explore these API's, we will use the npm-provided command wscat, but any websocket-client library will work.
Note: If a valid API key is not found in the initial request you will receive a response
invalid api key '<api_key>' and the websocket connection will be closed. If you don't have an API Key at this time please see Authentication for more details on obtaining one.
You may optionally include a
blockchain-id with the request. If no blockchain id is supplied then it will default to
ethereum-mainnet. Refer to the Blockchain Id to obtain a list of blockchain ids.
First, connect to the Amberdata web3api.io endpoint via SSL websocket with your API key:
❯ npm install -g wscat ❯ wscat -c "wss://ws.web3api.io" -H "x-api-key: <api-key>" -H "x-amberdata-blockchain-id: ethereum-mainnet" connected (press CTRL+C to quit) >
You are now connected and ready to initiate any websocket request.