How to Access Solana WebSocket Connection

Learn how to connect with Solana WebSocket.

Step 1: Authorize your request. Learn more: Authentication Guide

wsdump --headers 'Authorization: Bearer YOUR_API_KEY' 

Step 2: Use the following WebSocket URL:

wss://svc.blockdaemon.com/:protocol/:network/native?service_name=:service

Step 3: Specify a Solana method in the request body:

{ 
  "jsonrpc": "2.0", 
  "id": 1, 
  "method": "slotSubscribe"
}

Example Request

Here is an example for using slotsubscribe to receive notification anytime a slot is processed by the validator

--headers 'Authorization: Bearer YOUR_API_KEY' \
wss://svc.blockdaemon.com/solana/mainnet/native?service_name=ws \
'{ "jsonrpc": "2.0", "id": 1, "method": "slotSubscribe" }'

The following is a typical response you will get:

{ 
  "jsonrpc": "2.0", 
  "result": 0, 
  "id": 1 
}

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.