When a WebSocket connection is made via ari.start, it is often useful to know
when that connection has fully established. This is particularly true when
REST calls have to be made that are application dependent (such as subscribing
for particular event sources), as those calls will fail if a WebSocket connection
is not made.
This patch modifies ari.start such that it returns a Promise that is resolved
on the open callback of the underlying WebSocket library, and is rejected on
any error returned back from the same library.
It might be good to add documentation for this. However, since using as Callback will simply return a Promise that will be ignored by current applications, it's not paramount.
When a WebSocket connection is made via ari.start, it is often useful to know when that connection has fully established. This is particularly true when REST calls have to be made that are application dependent (such as subscribing for particular event sources), as those calls will fail if a WebSocket connection is not made.
This patch modifies ari.start such that it returns a Promise that is resolved on the open callback of the underlying WebSocket library, and is rejected on any error returned back from the same library.