A WebSocket connection should be made with the Treehouse service at wss://wss.treehouse.finance/by adding a valid API key to the headers: X-API-Key: {Your_API_Key}.
A successful connection will receive a response object when the connection is established. Here is an example of the response:
Status Code: 101 Switching Protocols
upgrade: websocket
connection: Upgrade
sec-websocket-accept: 34Aa+LCsEtjdWnzo5V8UgaJ+tE0=
date: Thu, 03 Aug 2023 16:59:50 GMT
server: istio-envoy
Subscriptions
Once a connection has been made with the WebSocket, you can subscribe to receive ETH and AVAX transactions sent or received by a wallet address:
{
"event_data": {
"0x28c6c06298d514db089934071355e5743bf21d60": [
"eth",
"avax"
],
// ... other wallets subscribed to the transaction channel
},
"event_name": "subscribe-transaction-channel"
}
To update a request to subscribe to more or fewer wallet addresses and chains, update event_data accordingly and send another request message to the WebSocket.
To unsubscribe from the transaction channel, send a request message with the following: