Bitquery streaming doesn't work

Hi,

I have a problem with Bitquery streaming.
I am developing Bitquery data-based application.
Previously, I was guided by a member of Bitquery to use Bitquery streaming to show the real-time chart.

From this link: https://streaming.bitquery.io/stomp
I use sockjs-client and stomp to be able to work real-time with bitquery

But now it seems that https://streaming.bitquery.io/stomp is no longer working. I get a 404 error when trying to connect to it.

I also didn’t find any public documentation about working real-time with Bitquery, is there any?

So I would like to get help from the community or Bitquery admin to solve this problem.

Thanks!

Hi, now there is (https|wss)://streaming.bitquery.io/graphql
You can use it, for example, with this library

Example:

import { createClient } from 'graphql-ws'

const client = createClient({
	url: 'wss://streaming.bitquery.io/graphql'
});

const payload = {
	query: `subscription {
				EVM(network: bsc){
					Transfers(Transfer: {Currency: {HasURI: true}}) {
						Transfer {
							Receiver
							Currency {
								Name
							}
							URI
						}
					}
				}
			}`
};

(async () => {
	const onNext = data => { 
                /* handle incoming values */
        }

	let unsubscribe = () => {
		/* complete the subscription */
	};

	await new Promise((resolve, reject) => {
		unsubscribe = client.subscribe(payload, {
			next: onNext,
			error: reject,
			complete: resolve,
		});
	});
})();

Ok, thank you!

And I have a question that how I can use a query like in the endpoint (https|wss)://streaming.bitquery.io/graphql:

subscription subscribeTransaction($network: EthereumNetwork!, $from: ISO8601DateTime, $baseAddress: String) {
  ethereum(network: $network) {
    dexTrades(options: { desc: ["block.height", "tradeIndex"] }, baseCurrency: { is: $baseAddress }, time: { since: $from }) {
      side
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      tradeIndex
      exchange {
        fullName
      }
      smartContract {
        address {
          address
          annotation
        }
      }
      baseAmount
      baseAmountUSD: baseAmount(in: USD)
      baseCurrency {
        address
        symbol
      }
      quoteAmount
      quoteAmountUSD: quoteAmount(in: USD)
      quoteCurrency {
        address
        symbol
      }
      transaction {
        hash
      }
    }
  }
}

Previously I used the query above.

Thank you for your supporting!

You can use our IDE for creating new query
Change URL to https://streaming.bitquery.io/graphql

When passing the parameters to the apollo subscription, it doesn’t work correctly

I subscribe 2 tokens
0x55d398326f99059ff775485246999027b3197955
0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c

network: bsc

But the data responded from the Bitquery server seems wrong, It returns tokens that I didn’t request as you can see the image below.

The query

export const SubscribeTradingDocument = gql`
    subscription subscribeTrading($network: network!, $baseCurrency: String!, $quoteCurrency: String!) {
  EVM(network: $network) {
    buy: DEXTrades(
      Trade: {Sell: {Currency: {SmartContract: {is: $baseCurrency}}}, Buy: {Currency: {SmartContract: {is: $quoteCurrency}}}}
    ) {
      Block {
        Time
      }
      Trade {
        Sell {
          Buyer
          Amount {
            Decimal
          }
          Currency {
            Symbol
          }
        }
        Buy {
          Price
          Amount {
            Decimal
          }
          Currency {
            Symbol
          }
        }
      }
    }
    sell: DEXTrades(
      Trade: {Buy: {Currency: {SmartContract: {is: $baseCurrency}}}, Sell: {Currency: {SmartContract: {is: $quoteCurrency}}}}
    ) {
      Block {
        Time
      }
      Trade {
        Sell {
          Price
          Buyer
          Amount {
            Decimal
          }
          Currency {
            Symbol
          }
        }
        Buy {
          Amount {
            Decimal
          }
          Currency {
            Symbol
          }
        }
      }
    }
  }
}
    `;

Calling subscription


const vars: SubscribeTradingSubscriptionVariables = useMemo(
    () => ({
      network: "bsc",
      baseCurrency: "0x55d398326f99059ff775485246999027b3197955",
      quoteCurrency: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"
    }),
    []
  );

  useSubscribeTradingSubscription({
    onData: (data) => {
      console.log("COMING", data.data.data?.EVM);
    },
    variables: {
      ...vars,
    },
  });

The request from chrome inspection

The response from chrome inspection