Websocket API


Installation Guide

The API is very similiar to the RPC API, the only difference is the way you connect to the Node. Our preffered method is to use wscat as client for connecting to websockets. wscat can be installed using npm:

$ sudo npm install -g wscat

Connect using Ankr Endpoint

To connect to the endpoint, we will use the following command:

$ wscat -c http://ws-<your-app-id>.ankr.com
Connected (press CTRL+C to quit)

Simple Request Example

After Connected is shown, you can make a simple query as the following:

Connected (press CTRL+C to quit)
> {"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":53}
< {"jsonrpc":"2.0","id":53,"result":"Geth/v1.0.2-bfb73f80/linux-amd64/go1.14.6"}