autobahn-js icon indicating copy to clipboard operation
autobahn-js copied to clipboard

Fail outstanding promises on connection loss

Open oberstet opened this issue 6 years ago • 2 comments

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.

oberstet avatar Jun 19 '18 22:06 oberstet

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.

oberstet avatar Jun 19 '18 22:06 oberstet

here https://github.com/crossbario/autobahn-js/blob/c380038a7e7637963299633eae0e7e1abe124fe3/packages/autobahn/lib/session.js#L1237

oberstet avatar Oct 16 '19 10:10 oberstet