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.

    QuickstartBeta

    Open a WebSocket, subscribe to a network@table stream, and start receiving decoded blocks in real time. Pick a stream below — then drop the URL into wscat, Node, or the browser.

    Endpoint
    WS
    1# npm i -g wscat
    2wscat -c "wss://ws.pinax.network/ws/solana@swaps?token=<YOUR_JWT>"
    No API key loaded — samples show a <YOUR_JWT> placeholder. Open Try it to paste a token and stream live.
    Available streams (loading…)live from GET /streams

    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:value is case-insensitive equality; a bare value matches any column.
    • Combine with || (OR), && / whitespace (AND), ! (NOT), and ( ) grouping.
    • SET_FILTER replaces 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 inside events[*].
    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.