WebSocket Streams

Connect to YoorQuezt's WebSocket endpoint for real-time event streaming. Subscriptions use JSON-RPC 2.0 over WebSocket.

Connection URLs

EnvironmentURL
Productionwss://ws.yoorquezt.io/v1
Testnetwss://ws-testnet.yoorquezt.io/v1
Localws://localhost:9099/ws

JSON-RPC Subscription

To subscribe, send a JSON-RPC request with method yq_subscribe and the topic name as the first parameter:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "yq_subscribe",
  "params": ["auction"]
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "sub_abc123"
}

The result is your subscription ID, used for unsubscribing.

Topics

TopicDescription
auctionAuction lifecycle events: new bids, auction closed, winning bundle selected, bid rejected
protectProtection events: MEV detected on a transaction, attack mitigated, rebate accumulated
blocksNew block events with MEV statistics, included bundles, and builder information
mempoolMempool activity: new pending transactions, bundle submissions, transaction removals
intentsIntent lifecycle events: new intent submitted, solver solution received, intent filled or expired

Event Format

Subscription events are delivered as JSON-RPC notifications:

{
  "jsonrpc": "2.0",
  "method": "yq_subscription",
  "params": {
    "subscription": "sub_abc123",
    "result": {
      "event": "auction.bid",
      "timestamp": "2026-03-15T12:34:56Z",
      "data": {
        "auction_id": "auc_789",
        "bidder": "0xSearcherAddress",
        "bundle_hash": "0xbundle...",
        "bid_amount": "0.05",
        "block_number": 19500000
      }
    }
  }
}

Unsubscribe

To stop receiving events for a subscription:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "yq_unsubscribe",
  "params": ["sub_abc123"]
}

Response

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": true
}

JavaScript Example

const WebSocket = require("ws");

const ws = new WebSocket("wss://ws.yoorquezt.io/v1", {
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
  },
});

const subscriptions = {};

ws.on("open", () => {
  console.log("Connected to YoorQuezt WebSocket");

  // Subscribe to auction events
  ws.send(JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "yq_subscribe",
    params: ["auction"],
  }));

  // Subscribe to protection events
  ws.send(JSON.stringify({
    jsonrpc: "2.0",
    id: 2,
    method: "yq_subscribe",
    params: ["protect"],
  }));

  // Subscribe to new blocks
  ws.send(JSON.stringify({
    jsonrpc: "2.0",
    id: 3,
    method: "yq_subscribe",
    params: ["blocks"],
  }));
});

ws.on("message", (data) => {
  const msg = JSON.parse(data);

  // Handle subscription confirmations
  if (msg.id && msg.result && typeof msg.result === "string") {
    const topics = { 1: "auction", 2: "protect", 3: "blocks" };
    subscriptions[msg.result] = topics[msg.id];
    console.log(`Subscribed to ${topics[msg.id]}: ${msg.result}`);
    return;
  }

  // Handle subscription events
  if (msg.method === "yq_subscription") {
    const { subscription, result } = msg.params;
    const topic = subscriptions[subscription];

    switch (result.event) {
      // Auction events
      case "auction.bid":
        console.log(`[auction] New bid: ${result.data.bid_amount} ETH from ${result.data.bidder}`);
        break;
      case "auction.closed":
        console.log(`[auction] Auction closed: winner ${result.data.winner}`);
        break;

      // Protection events
      case "protect.detected":
        console.log(`[protect] MEV detected on ${result.data.tx_hash}: ${result.data.attack_type}`);
        break;
      case "protect.mitigated":
        console.log(`[protect] Attack mitigated for ${result.data.tx_hash}`);
        break;
      case "protect.rebate":
        console.log(`[protect] Rebate: ${result.data.amount} ${result.data.token}`);
        break;

      // Block events
      case "block.new":
        console.log(
          `[blocks] Block ${result.data.block_number}: ` +
          `${result.data.bundles_included} bundles, ` +
          `${result.data.mev_extracted} ETH MEV`
        );
        break;

      default:
        console.log(`[${topic}] ${result.event}:`, result.data);
    }
  }
});

ws.on("close", (code, reason) => {
  console.log(`Disconnected: ${code} ${reason}`);
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err.message);
});
Edit this page