Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does an error occur if kept in the background ? #204

Open
DIVANSHMAHAJAN opened this issue Jan 27, 2022 · 0 comments
Open

Why does an error occur if kept in the background ? #204

DIVANSHMAHAJAN opened this issue Jan 27, 2022 · 0 comments

Comments

@DIVANSHMAHAJAN
Copy link

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

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant