I`ve tried to connect to the websocket api over getblock.io but it always fails. Here below is JS code. But HttpProvider works fine on "https://bsc-mainnet.web3api.com/v1/API_KEY".
web3ws = new Web3(new Web3.providers.WebsocketProvider('wss://bsc.getblock.io/mainnet/?api_key=API_KEY'));
if (web3ws.isConnected)
console.log("Connected");
else
console.log("Not Connected");
Am I missing something here ? Should i have to pay it first to able to use this service?
GetBlock currently (May 2021) doesn't support WebSocket provider.
From their pricing page:
If HTTPS provider is sufficient to your use case (e.g. if you don't need to use the web3 subscriptions), you can use any provider that only supports HTTPS connection. Including GetBlock or the recommended providers stated in the BSC docs
Othwerwise, you'll need to use a different third-party provider that supports WebSockets or configure your own.