Quickstart
Learn how to connect to the GoldRush Streaming API to receive real-time blockchain events over WebSocket.
Prerequisites
Using any of the GoldRush developer tools requires an API key.
Get Started
Sign up for a free API key to get started with GoldRush.
Connection
The Streaming API supports GraphQL subscriptions over WebSocket, using the GraphQL over WebSocket protocol.
The recommended approach is to use the official TypeScript Client SDK which supports the Streaming API and manages all WebSocket connections.
You can also use a GraphQL over WebSocket protocol npm package like graphql-ws
.
If you’re not using the graphql-ws
package, you must set the WebSocket protocol header:
"Sec-WebSocket-Protocol" : "graphql-transport-ws"
This header is required for the server to properly recognize and handle your GraphQL subscription requests.
OHLCV Token Stream Code Samples
The following examples show how to connect and subscribe to the OHLCV Token stream using your preferred language or tool. Each sample connects to the WebSocket endpoint, authenticates with your API key, and streams real-time OHLCV updates for a token on Base Mainnet.
Response Format
Here is an example of the response you should receive from the above code samples: