Skip to content

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

@DIVANSHMAHAJAN

Description

@DIVANSHMAHAJAN

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

};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions