I have a websocket app that connects to my Java backend via stomp.js file.
function connect() {
var socket = new SockJS('<?php echo $rootbasename;?>wsconnect');
stompClient = Stomp.over(socket);
stompClient.debug = null;
stompClient.connect({}, function (frame) {
console.log('Connected: ' + frame);
console.log('/queue/messages/' + widgetId + "/" + $.cookie(cookiename));
stompClient.subscribe('/queue/messages/' + widgetId + "/" + $.cookie(cookiename), function (result) {
//code here
}, {userToken: $.cookie(cookiename), widgetId: widgetId});
stompClient.subscribe('/queue/makereadresult/' + widgetId + '/' + $.cookie(cookiename), function (result) {
});
But, what if my java backend server will reboot? I want customers not to notice any change. Is there a way to auto-reconnect on connection lost? Or any way to make it smooth for clients?