Right now the clientadds a new listener on the plugin for every message that's in flight and waiting for a response. This means that if it has more than 10 messages waiting for responses, it will trigger the warning about a potential memory leak.
Instead of adding a listener for each request, I think it would be better to have one listener for incoming_message. The handler would look up the corresponding resolve and reject functions by the requestId in a map on the client.
Right now the
client
adds a new listener on the plugin for every message that's in flight and waiting for a response. This means that if it has more than 10 messages waiting for responses, it will trigger the warning about a potential memory leak.Instead of adding a listener for each request, I think it would be better to have one listener for
incoming_message
. The handler would look up the correspondingresolve
andreject
functions by therequestId
in a map on the client.Credit to @dappelt for discovering this.