3
I am trying to establish a communication between Rabbitmq and Javascript, to recover the log information that is sent to a Rabbitmq topic, but without success. In the console is displayed the following information:
Opening Web Socket...
WebSocket connection to 'ws://10.224.200.196:61613/' failed: WebSocket opening handshake timed out
Whoops! Lost connection to ws://10.224.200.196:61613/
This is my Javascript connection code:
var test = {
client: null,
onConnect: function () {
client.subscribe("add-on", this.onMessage, {ack: 'client'});
console.log('connected');
},
onMessage: function (message) {
console.log(message);
message.ack();
},
onError: function () {
console.log('error');
},
connect: function () {
this.client = Stomp.client('ws://10.224.200.196:61613/', 'v11.stomp');
this.client.connect('test', 'test', this.onConnect, this.onError, '/');
}
};
test.connect();
User is created in Rabbitmq as "Monitoring"
The Stomp plugin has been enabled
I already created the topic through Rabbitmq
I get these messages in the Rabbitmq log
=INFO REPORT==== 4-Oct-2017::08:05:07 ===
accepting STOMP connection <0.672.0> (10.224.200.188:56652 -> 10.224.200.196:61613)
=INFO REPORT==== 4-Oct-2017::08:09:07 ===
closing STOMP connection <0.672.0> (10.224.200.188:56652 -> 10.224.200.196:61613)
How do I connect and receive messages?
I’ve used several tutorials, the last were: