autobahn-js
autobahn-js copied to clipboard
Fail outstanding promises on connection loss
When a connection is lost, the library should fire any outstanding promises for requests (calls, subscribe acknowledged publishes, etc) with error.
Eg ABPy has an errback_outstanding_requests
function centralizing the code for this: https://github.com/crossbario/autobahn-python/blob/master/autobahn/wamp/protocol.py#L1182
We should have similar here in ABJS.
In a way, promises left unfired forever are the resource leak kind of bugs in async programming.
So it could be a good idea to add internal bookkeeping to ABJS to track all promises created and returned by the library to user code and make sure we both start and end with an empty list always.
here https://github.com/crossbario/autobahn-js/blob/c380038a7e7637963299633eae0e7e1abe124fe3/packages/autobahn/lib/session.js#L1237