crossbario / autobahn-js

WAMP in JavaScript for Browsers and NodeJS
http://crossbar.io/autobahn
MIT License
1.43k stars 228 forks source link

Fail outstanding promises on connection loss #360

Open oberstet opened 6 years ago

oberstet commented 6 years ago

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 commented 6 years ago

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 commented 5 years ago

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