WSSET_FILTER
Drop non-matching events from the wire before delivery, reducing bandwidth (and billable messages). params is [selector, expression], where expression is an SQE expression string. You can also set a filter at connect time with ?filter=<url-encoded-expr> (alias ?sqe=) on the upgrade URL.
Request
Request
{ "method": "SET_FILTER", "params": [ "solana@swaps", "protocol:raydium_cpmm && user:F2MUEfN1HG5mC5EiUoxhjjc7HpKi4QQnzvipnbGx6Av8" ], "id": 1 }
See Filters for the full SQE syntax and worked ERC-20 and Solana examples.
Reply
Reply
{ "result": null, "id": 1 }
Semantics
field:valueis case-insensitive equality; a barevaluematches any column.- Combine with
||(OR),&&/ whitespace (AND),!(NOT), and( )grouping. SET_FILTERreplaces the filter for a selector — it does not accumulate. Combine conditions in one expression instead.- You receive only matching events; if every event of a block is filtered out, the block is skipped for you.
- Top-level fields (
block_num,network,module_hash) are not filterable — only keys insideevents[*].
Limits. Max terms and distinct fields per filter are server-configured (
SUBSTREAMS_WEBSOCKET_MAX_FILTER_VALUES / …_MAX_FILTER_FIELDS, defaults 512 / 16). An expression over a cap or with a parse error returns an error reply, leaves the previous filter unchanged, and keeps the socket open.