bitpay / bitcore

A full stack for bitcoin and blockchain-based applications
https://bitcore.io/
MIT License
4.85k stars 2.09k forks source link

v8 socket multiple address subscribe missing #2165

Open thackerronak opened 5 years ago

thackerronak commented 5 years ago

In the older version, we can subscribe multiple address transaction with the below code.

socket.on('connect', function () {
            socket.emit('subscribe', 'bitcoind/addresstxid', allAddresses);
            socket.emit('subscribe', 'inv');
        });

socket.on('bitcoind/addresstxid', data => {

        });

in v8 there is no support to subscribe to multiple addresses.

micahriggan commented 5 years ago
this.io.sockets.in(`/${chain}/${network}/address`).emit(address, sanitizedCoin);

We do emit outputs to addresses, could you join this room and then

for(const address of addresses) {
  socket.on(address, handler);
}

This may trigger multiple times for a single transaction though, since it's output based