react-stomp
react-stomp copied to clipboard
Why does an error occur if kept in the background ?
I am using react-stomp and stompjs and sockjs-client. However when the application is in background or not being used..and some other window is open.. It shows error after some time. **const onError = (err) => { window.alert("YES");
};** this line gets executed and shows YES ..plz tell me how to rectify this error.?
const connect = () => { const Stomp = require("stompjs"); var SockJS = require("sockjs-client"); SockJS = new SockJS("https://chat-lg.azurewebsites.net/ws"); stompClient=Stomp.over(SockJS); stompClient.connect({}, onConnected, onError); };
const onConnected = () => { stompClient.subscribe( "/user/" + currentUser.username + "/queue/messages", onMessageReceived ); };
const onError = (err) => { window.alert("YES");
};