There is a way to check if publishing a message has been successful or not:
var publication = client.publish('/foo', {text: 'Hi there'});
publication.then(function() {
// OK
}, function(error) {
// NOT OK, redirect
});
This one is documented.