easternbloc / node-stomp-client

A STOMP client for Node.js
Other
93 stars 47 forks source link

StompClient holding state after disconnected #33

Closed storkme closed 9 years ago

storkme commented 9 years ago

Hi,

Similar to #19 I'm looking into a way of handling re-connections if disconnected due to a socket error. My current solution is to register an error event listener, and simply call connect() (with no arguments).

The only issue I'm having with that is the client isn't designed to be used in this way, as the subscriptions and _stompFrameEmitter objects are re-used between connections, causing some side effects (messages being delivered multiple times, not re-subscribing to queues).

Something like this https://gist.github.com/storkme/43dec2d73bef5d804375 seems to do the trick, but it's hardly elegant. Perhaps it would make sense to expose a reset function or similar?