WSSET_FILTER
Drop non-matching events from the wire before delivery, reducing bandwidth (and billable messages). params is [selector, filterObject]. You can also set a filter at connect time with ?filter=<url-encoded-json> on the upgrade URL.
Request
Request
{ "method": "SET_FILTER", "params": [ "solana@swaps", { "protocol": "raydium_cpmm", "user": [ "a", "b" ] } ], "id": 1 }
Reply
Reply
{ "result": null, "id": 1 }
Semantics
- String equality only; values must be strings or arrays of strings.
- Fields are AND'd; values within a field are OR'd.
- An event missing a filtered field is dropped. If every event of a block is dropped, the block is skipped for that client.
- Filters are scoped per explicit
network@streamselector — wildcards always pass everything through. - Top-level fields (
block_num,network,module_hash) are not filterable — only keys insideevents[*].
Limits. Max keys and values per filter are server-configured (
SUBSTREAMS_WEBSOCKET_MAX_FILTER_FIELDS / …_MAX_FILTER_VALUES, defaults 16 / 64). An invalid payload returns an error reply without closing the socket.