I have a reactjs app which is connected to a oneSignal app for web notifications. here are my config for oneSignal
function OneSignalInit(appid) {
await OneSignal.init({
appId: appid
});
OneSignal.showSlidedownPrompt();
}
function initOneSignal(appId) {
/* Call push notification */
try {
return OneSignalInit(appId);
} catch (error) {
return console.log(error);
}
}
function App() {
useEffect(() => {
if (!hasPlayerId) {
hasPlayerId = true;
initOneSignal(process.env.REACT_APP_NOTIFICATION).then(async () => {
OneSignal.getUserId((userId) => {
if (userId) {
console.log(' ~ Player ID', userId);
}
});
});
}
}, []);
return (<div>OneSignal App</div>)
}
when i run it the app is connected and i receive the notifications fine, but after awhile I get this error
GET https://onesignal.com/api/v1/apps/APP_ID/icon net::ERR_CONNECTION_RESET
after that i can't get any notifications until i clear the browser cache and reload the page.
Any idea why it happens and how to restart the connection without having to clear the browser cache?