[rabbitmq-discuss] How to enable server side heartbeat for RabbitMQ?

Joshua Lim joshua__lim at hotmail.com
Sat Jan 11 10:21:16 GMT 2014


Hi, 
I'm using web-stomp plugin + SockJS/Stomp.js on PhoneGap and observed that under circumstances (probably related to 3G network instability), traffic can stop without triggering a connection error on the STOMP client.
To solve this problem, I thought that I may use heart beat so I added the following to the Javascript using stomp.js:
function Connect() {    console.log('Connecting...');    // Connect    var ws = new SockJS(mq_url);    client = Stomp.over(ws);    client.heartbeat.outgoing = 5000;   // if 5000 means client will send heart beat every 5000ms    client.heartbeat.incoming = 5000;   // if 0 means client does not want to receive heartbeats from server    client.debug = function (str) {        $("#debug").append(timeStamp() + str + "<br>");          varmessage = str;    };    client.connect(    mq_username, mq_password, on_connect, on_connect_error, mq_vhost);}
However, the following error is thrown by the STOMP JS client, which I assume is because the broker is not sending heart beat (which I assumed so as I don't know how to check).
-> PING-> PINGdid not receive server activity for the last 10017msWhoops!  Lost connection to undefined
I tried adding param to rabbitmq.config, but that didn't appear to work. The doc doesn't mention whether the heartbeat parameter is for client or server heartbeat.
[       {rabbit, [                {cluster_nodes, {['rabbit at server'], disc}},                 {cluster_partition_handling, autoheal},         {heartbeat, 1}        ]},

Rgds,Joshua 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140111/82f5a576/attachment.html>


More information about the rabbitmq-discuss mailing list