Closed IhChowdhury closed 4 years ago
Could not understand your code. I guess you are trying a create an new application. The following resources should help you:
Yeah, I have built a chat application using spring boot framework which uses stomp . Though we can exchange messages but very frequently we see socket get disconnected. to solve this i have tried above things recommend the the article. but it can not reconnect automatically again once disconnect. my application is hosted in aws beanstalk and i have seen this disconnect behavior in all browser.
I applied var client = Stomp.over(function(){ return new SockJS(url); });
After creating client stomp using this code then my socket connection can not established. I have found this code in one of stomp documentation.
Please use the resources I have suggested above.
I am trying to make an chat application. I am facing problem that After connecting stomp It disconnect though there has internet connection in my pc. Than I tried several steps to reconnect again:
var client = Stomp.over(function(){ return new SockJS(url); });
function initialize() { var socket = new SockJS('/service-sockect'); stompClient = Stomp.over(socket); stompClient.connect({}, function (frame) { successCallBack(); }, function (message) { console.log("Disconnected"); showNotice(1,"Server Connection Lost. Reconnecting...",'green'); reconnect('/service-sockect');
};
function reconnect(socketUrl) { var connected = false; let reconInv = setInterval(() => { ws = new WebSocket(socketUrl); stompClient = webstomp.over(ws); stompClient.connect({}, function (frame) { connected = true; successCallback(); }, function (message) { showNotice(1,"Server Connection Lost. Reconnecting...",'green'); if(connected){ reconnect(socketUrl); }
}); }, 1000);
};
** Now give me your opinion how can solve this issue.