Substreams WebSockets service — stream decoded blocks, swaps & transfers in real time.
    Read-only preview
    You're browsing the public WebSockets reference. Sign in to open a live stream with your team's API key.

    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@stream selector — wildcards always pass everything through.
    • Top-level fields (block_num, network, module_hash) are not filterable — only keys inside events[*].
    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.