Closed matt-mcelhaney closed 8 years ago
Thank you for the PR. I had a look at Stomp.js' callback implementations (error
and success
) and I think, I was wrong using a Promise for connect
in the first place. errorCallback
is called every time the connection is closed / lost and successCallback
is called every time the server responds with a CONNECTED
frame – I guess depending on the server implementation there might be rare cases in which this occurs more then once?
That's why I think it might be more suitable to just wrap the official implementation and use the good old callbacks. I'd like to incorporate this breaking changes in the next release and provide a proper notice with the release change.
Instead of invoking $q.defer reject method an external error callback function will now be called on connect/disconnect errors.
The error function calling dfd.reject() was not working as intended because the promise was resolved earlier upon success. If the stomp service would disconnect later then there was no way to properly watch for that and try to reconnect again.