Skip to content

Instantly share code, notes, and snippets.

@storkme
Last active August 29, 2015 14:13
Show Gist options
  • Save storkme/43dec2d73bef5d804375 to your computer and use it in GitHub Desktop.
Save storkme/43dec2d73bef5d804375 to your computer and use it in GitHub Desktop.
Description of a workaround for reconnects in node-stomp-client
var Stomp = require('stomp-client');
var client = new Stomp(host, port, user, password, '1.1', vhost);
client.connect(onConnect, onError);
function onConnect(sessId) {
//subscribe to queues etc
}
function onError(err) {
if (err.code === 'ECONNRESET') {
client.subscriptions = {};
client._stompFrameEmitter.removeAllListeners();
client.connect();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment