<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div>Hi, </div><div><br></div><div>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.</div><div><br></div><div>To solve this problem, I thought that I may use heart beat so I added the following to the Javascript using stomp.js:</div><div><br></div><div>function Connect() {</div><div> console.log('Connecting...');</div><div> // Connect</div><div> var ws = new SockJS(mq_url);</div><div> client = Stomp.over(ws);</div><div> client.heartbeat.outgoing = 5000; // if 5000 means client will send heart beat every 5000ms</div><div> client.heartbeat.incoming = 5000; // if 0 means client does not want to receive heartbeats from server</div><div> client.debug = function (str) {</div><div> $("#debug").append(timeStamp() + str + "<br>"); </div><div> varmessage = str;</div><div> };</div><div> client.connect(</div><div> mq_username, mq_password, on_connect, on_connect_error, mq_vhost);</div><div>}</div><div><br></div><div>However, the following error is thrown by the STOMP JS client, which I assume is because the broker is not sending<span style="font-size: 12pt;"> heart beat (which I assumed so as I don't know how to check).</span></div><div><br></div><div>-> PING</div><div>-> PING</div><div>did not receive server activity for the last 10017ms</div><div>Whoops! Lost connection to undefined</div><div><br></div><div><span style="font-size: 12pt;">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.</span></div><div><br></div><div>[</div><div> {rabbit, [</div><div> {cluster_nodes, {['rabbit@server'], disc}},</div><div> {cluster_partition_handling, autoheal},</div><div> {heartbeat, 1}</div><div> ]},</div><div><br></div><div><br></div><div>Rgds,</div><div>Joshua</div> </div></body>
</html>