Hi<div>Probably you need to create new SockJS object (tcp connection) on disconnect. See line 16. I assume ws is TCP connection object. More info for SockJS you can find at&nbsp;<a href="https://github.com/sockjs/sockjs-client">https://github.com/sockjs/sockjs-client</a>.</div><div>Try to move lines 16-22 to Connect() function.</div><div>Also, any debug messages on reconnect attempt are welcome.&nbsp;</div><div><br>On Saturday, July 20, 2013 8:31:03 PM UTC+3, joshu...@hotmail.com wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Using references on&nbsp;<a href="http://jmesnil.net/stomp-websocket/doc/" target="_blank">http://jmesnil.net/stomp-<wbr>websocket/doc/</a> and&nbsp;<a href="http://www.rabbitmq.com/web-stomp.html" target="_blank">http://www.rabbitmq.com/<wbr>web-stomp.html</a>, I managed to come out with my own Web-Stomp js code that can connect and receive messages. &nbsp;However, I'm unable to reconnect in the event the connection to Web-Stomp server breaks.<div><br></div><div>What I did is on on_connect_error, I did a client.disconnect, followed by a client.connect. &nbsp;The disconnect works but the connect fails. &nbsp;</div><div><br></div><div>Since I'm not able to find any code example that deals with reconnecting, I took a look at sockjs groups but it appears to me that the code used for sockjs is different from that of web-stomp plugin examples.</div><div><br></div><div>Here's the full js code: Here is my full code:&nbsp;<a href="http://pastebin.com/dtEBnzGP" target="_blank">http://pastebin.com/<wbr>dtEBnzGP</a></div><div><br></div><div><ol style="margin:0px;padding:0px 0px 0px 48px;color:rgb(172,172,172);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace,serif;font-size:12px;line-height:21px;background-color:rgb(248,248,248)"><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px"><span style="color:rgb(0,0,102);font-weight:bold">function</span>&nbsp;on_connect_error<span style="color:rgb(0,153,0)">(</span>erro<wbr>r<span style="color:rgb(0,153,0)">)</span>&nbsp;<span style="color:rgb(0,153,0)">{</span></div></li><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px">&nbsp; $<span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">'#output'</span><span style="color:rgb(0,153,0)">)</span>.<span style="color:rgb(102,0,102)">append</span><span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">'<wbr>Connection failed! Error:'</span><span style="color:rgb(51,153,51)">+</span>&nbsp;error&nbsp;<span style="color:rgb(51,153,51)">+</span>&nbsp;<span style="color:rgb(51,102,204)">"&lt;br&gt;"</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;</span></div></li><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px">&nbsp; &nbsp; $<span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">'#output'</span><span style="color:rgb(0,153,0)">)</span>.<span style="color:rgb(102,0,102)">append</span><span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">'<wbr>Disconnecting....'</span>&nbsp;&nbsp;<span style="color:rgb(51,153,51)">+</span>&nbsp;<span style="color:rgb(51,102,204)">"&lt;br&gt;"</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;</span></div></li><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px">&nbsp;client.<span style="color:rgb(102,0,102)">disconnect</span><span style="color:rgb(0,153,0)">(</span><span style="color:rgb(0,0,102);font-weight:bold">function</span><span style="color:rgb(0,153,0)">(</span><span style="color:rgb(0,153,0)">)</span>&nbsp;<span style="color:rgb(0,153,0)"><wbr>{</span></div></li><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px">&nbsp; &nbsp; $<span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">'#output'</span><span style="color:rgb(0,153,0)">)</span>.<span style="color:rgb(102,0,102)">append</span><span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">'<wbr>Disconnected!'</span>&nbsp;<span style="color:rgb(51,153,51)">+</span>&nbsp;<span style="color:rgb(51,102,204)">"&lt;br&gt;"</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;</span></div></li><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px">&nbsp;&nbsp;<span style="color:rgb(0,153,0)">}</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;</span></div></li><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px">&nbsp; $<span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">'#output'</span><span style="color:rgb(0,153,0)">)</span>.<span style="color:rgb(102,0,102)">append</span><span style="color:rgb(0,153,0)">(</span><span style="color:rgb(51,102,204)">'<wbr>Reconnecting...'</span>&nbsp;<span style="color:rgb(51,153,51)">+</span>&nbsp;<span style="color:rgb(51,102,204)">"&lt;br&gt;"</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;</span></div></li><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px">&nbsp; Connect<span style="color:rgb(0,153,0)">(</span><span style="color:rgb(0,153,0)">)</span><span style="color:rgb(51,153,51)">;</span></div></li><li><div style="padding-right:5px;padding-left:5px;vertical-align:top;color:rgb(0,0,0);border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);background-color:rgb(255,255,255);line-height:21px"><span style="color:rgb(0,153,0)">}</span></div></li></ol></div></blockquote></div>