Filter Configuration
Guide to using our WebSocket filters.
Applying Filters to WebSocket Data Streams
To receive specific data streams from the WebSocket connection, you need to apply filters by sending a configuration message after opening a connection. Each data stream type (e.g., trades, transfers, oracle) is represented as an object within the filters
property of the configuration message.
How to Send a Configuration Message
- Construct the Configuration Message:
- Each data stream type is an object within the
filters
property. - Specify filter criteria within the corresponding object.
- If an object is empty, it means you will receive all data for that type.
- Each data stream type is an object within the
- Example Configuration Message:
{ “type”: “configure”, “filters”: { “trades”: { “programId”: “YourProgramIdHere”, “marketId”: “YourMarketIdHere” }, “transfers”: {}, // This will receive all transfer events “oraclePrices”: {} // This will receive all oracle events } }
Important Notes:
- Empty Objects: If the object for a data stream type is empty, you will receive all data for that type. For example, an empty
transfers
object means you will get all transfer events. - Combination of Filters: Filters can be combined in any way to tailor the data you need, ensuring you only receive relevant data. By following these instructions, you can effectively apply filters to your WebSocket data streams and manage the data you receive according to your needs.
Updated about 1 month ago