davinkevin / AngularStompDK

Angular service to communicate to Stomp-Websocket
http://davinkevin.github.io/AngularStompDK/
Apache License 2.0
36 stars 12 forks source link

Rejected promise during reconnection #42

Closed baczus closed 8 years ago

baczus commented 8 years ago

Hi, I noticed that library rejects promise when connection fails and creates new one after dealy (this.settings.timeOut). If I set 30 seconds to reconnect, during this time functions send and unsubscribe won't work properly, because they rely on promise, which is rejected.

davinkevin commented 8 years ago

You want to send data when the system isn't connected ? Even if the modification are made to support that, the Stomp.js underlying system wont allow this operation.

From the official doc of Stomp.js :

When a client is disconnected, it can no longer send or receive messages

So, I think the problem is somewhere else. You have to choose a smaller timeOut or check the state of the connection. I could add a method on the service to say if the system is connected or not (which will rely on the state of the promise).

baczus commented 8 years ago

Good point. Right now it is imposibble to determine state of the connection. It would be great if you could add such a method.

davinkevin commented 8 years ago

I'll close this issue and open another to add this element :D