react-stomp icon indicating copy to clipboard operation
react-stomp copied to clipboard

Why does an error occur if kept in the background ?

Open DIVANSHMAHAJAN opened this issue 3 years ago • 0 comments

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");

};

DIVANSHMAHAJAN avatar Jan 27 '22 08:01 DIVANSHMAHAJAN