5

According to the docs, Blockchain.info provides a websocket API that streams a few things:

  1. All unconfirmed transactions using "op: unconfirmed_sub"

  2. New blocks & the data they contain using "op: blocks_sub"

  3. All new tx that are detected at a subscribed address using "op: addr_sub", "addr": the address you want notifications.

I'm mostly interested in #3. If I send the "op: addr_sub" command, my websocket client will show all new tx from the moment of that subscription until the socket connection is closed. That's all well and good, but......

Is there a way to UNSUBSCRIBE from an address in the addr_sub list? There appears to be a socket command "op: unconfirmed_unsub" which will halt the subscription for all unconfirmed tx, but no analog for individual address.

Does anyone know the answer for this? How to unsubscribe from an individually watched address? If my purposes have been satisfied for watching an address and I wish to free up those resources how do I go about doing that? Surely, I don't have to close the entire connection and re-subscribe to everything BUT that address?

I'd imagine there has to be some way to achieve this without requiring the subscription to be immortal.... The docs from their site https://blockchain.info/api/api_websocket are very sparse

1

There is now the addr_unsub command taking an addr parameter to unsubscribe address updates.

0

A solution I've thought about is to disconnect and then reconnect and subscribe to the few addresses I must watch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.