aragon.js
aragon.js copied to clipboard
RPC: Potential memory leak from multi-emission subscriptions
There is no way to unsubscribe after doing sendAndObserveResponses.
For example, sending:
{
id: 1,
jsonrpc: '2.0',
method: 'accounts'
}
will trigger the wrapper to always send updates with id: 1.
I suppose this could be be a common pattern:
onButtonClick () {
const accounts = await app.accounts.toPromise()
...
}
which will make the wrapper send updates for each JSONRPC request, even though the client would expect a one time response.
I can't really find the pub/sub spec :thinking: , but it should be something like this: https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB
One thought on this, we could wrap sendAndObserveResponses() with an endWith, sending a message to the wrapper to also end the stream on its side.