Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to check socket connection is available or not in nodejs #82

Open
SivaPsr opened this issue Jun 7, 2018 · 0 comments
Open

How to check socket connection is available or not in nodejs #82

SivaPsr opened this issue Jun 7, 2018 · 0 comments

Comments

@SivaPsr
Copy link

SivaPsr commented Jun 7, 2018

Hi @gdaws @scop

I was use stompit module for connect activeMQ in node js.

My problem : Unable to identify whether broker is connected or not in stompit.ConnectFailover

Here is my code:

var stompit = require('stompit')

var connectionManager = new stompit.ConnectFailover();

connectionManager.addServer({
  'host': 'localhost',
  'port': 61623,
  'connectHeaders':{
    ...
  }
});

var channel = new stompit.Channel(connectionManager);

var subscribeHeaders = {
    'destination': '/queue/test',
    'ack': 'client'
};


channel.subscribe(subscribeHeaders, function(error, message){
    if (error) {
        console.log(error);
        return;
    }  
});

//send . But not throw error , even broker is not started
//always trying to reconnect
sendDlQ(subscribeHeaders, 'Hello');


function sendDlQ(header, body){
     channel.send(header, body);
}

Whenever call send method , always success. Even broker is not started.

Is there any possible to identify activeMQ broker is connected or not before send ?

@SivaPsr SivaPsr changed the title How to check socket connection is available or not in nodejs stompit How to check socket connection is available or not in nodejs Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant