WebSocket Quickstart
Open an authenticated Solana WebSocket and receive live slot updates.
Use WebSocket subscriptions for account changes, logs, signatures, slots, blocks, and votes.
Connect from a terminal
Install wscat, then pass your API key during the HTTP upgrade.
npm install --global wscatexport NLN_API_KEY="YOUR_API_KEY"wscat -c wss://ws.nln.clr3.org -H "x-api-key: $NLN_API_KEY"Send a slot subscription after the connection opens.
{ "jsonrpc": "2.0", "id": "slots", "method": "slotSubscribe"}The first response contains a numeric subscription ID. Later messages use slotNotification.
{ "jsonrpc": "2.0", "method": "slotNotification", "params": { "result": { "parent": 357954000, "root": 357953968, "slot": 357954001 }, "subscription": 42 }}Stop the subscription
Pass the subscription ID to slotUnsubscribe.
{ "jsonrpc": "2.0", "id": "stop-slots", "method": "slotUnsubscribe", "params": [42]}Browser clients
The browser WebSocket constructor has no option for custom upgrade headers. Do not place your API key in browser code.
Use one of these paths:
- Open the connection from your backend.
- Relay selected events to your browser.
- Keep the NoLimitNodes key in server-side secrets.