bcoin-org / bclient

Bcoin node and wallet clients
Other
11 stars 20 forks source link

Share websocket connection #1

Open pacoccino opened 6 years ago

pacoccino commented 6 years ago

Hi there,

I am currently using bcoin in a large scale application and now looking into this wallet rewrite. I am concerned about watching thousands of wallet and the performances problems of having thousands of web sockets connection on the same process.

It seems like the bcurl’s client is not bound to a specific wallet, so we don’t need to have one instance for every wallet (today by inheritance). Instead, we could share one instance, so it also share the web socket connection in same process.

This way, each wallet ask client to register to a wallet id, then the client will receive events for every wallets. It could re-dispatch these events with wallet id in name of event, so each wallet only get event that is is destined to.

socket.on(‘wallet tx’) => this.emit('wallet:walletId tx’)

Do you think this is envisageable ?

chjj commented 6 years ago

Yeah, I agree with you. We really need to refactor how the wallet management is done. We can work on it after this next release I think.

pacoccino commented 6 years ago

Hey thanks for the answer @chjj .

We have managed to finish our product without the sockets, but we're now in kind of optimisation phase. Didn't have a look at bcoin news for a while. We will try to migrate to the latest version soon. What are the plans for the next release ?