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.

    WSSUBSCRIBE

    Add <network>@<table> channels to this connection's subscription set. params is required and accepts wildcards (*@swaps, solana@*) and comma-separated network lists (solana,base@swaps).

    Envelope. Every command is one JSON text frame — { "method", "params", "id" } — and the server replies with exactly one frame: { "result", "id" } on success or { "error": "<message>", "id" } on failure. method is case-sensitive; id is echoed back so you can correlate. Invalid commands return an error reply but never close the socket.

    Request

    Request
    {
      "method": "SUBSCRIBE",
      "params": [
        "solana@swaps",
        "mainnet@erc20_transfers"
      ],
      "id": 1
    }

    Reply

    Reply
    {
      "result": null,
      "id": 1
    }
    • Idempotent. Re-subscribing to a selector you already hold is a no-op.
    • All-or-nothing. A single bad selector rejects the whole command with an error reply — the existing set is unchanged.
    • No snapshot. Only future blocks are delivered; SUBSCRIBE does not replay history.
    • wrap_envelope is fixed at upgrade time and is not affected by SUBSCRIBE — reconnect to change envelope mode.