When a page has a high load (eg it takes 30 seconds to render) browsersync will have lost it's connection and on reconnect it refreshes, this keeps on going until the server is stopped
use browsersync, make a page do some heavy lifting for 30 seconds then watch as the page keeps refreshing just after crunching for a while
{cli command here}
.init({
server: distDir,
ghostMode: false,
reloadOnRestart: false,
port: params.port || config.browserSyncPort || 3000,
open: (typeof params.openBrowser === 'boolean') && params.openBrowser || config.openBrowser || false,
middleware: function (req, res, cb) {
// When using multiple languages, the root does not contain html files
if (hasMultipleLocales && req.url === '/') {
res.writeHead(302, { 'Location': `/${config.defaultLanguage || 'en'}/` });
res.end();
req.url = `/${config.defaultLanguage || 'en'}/`;
return;
}
if (req.url.indexOf('.') > -1) {
return cb();
}
const uri = url.parse(req.url);
if (
uri.pathname.length > 1
&& path.extname(uri.pathname) === ''
&& fs.existsSync(path.join(distDir, uri.pathname + '.html'))
) {
req.url = uri.pathname + '.html' + (uri.search || '');
}
cb();
}
});
I was experiencing something similar, and seemingly resolved it by increasing the init config object's socketio clients.heartbeatTimeout to be a minute.
e.g:
...
socket: {
clients: {
heartbeatTimeout: 60000
}
}
Thanks for your quick reply @travomic, this might be exactly what I was looking for. I am currently not at work but I will give this a shot next monday morning and report my findings.
I noticed the same thing starting with 2.24.5 also! For me, it would appear when staying on any breakpoint longer than heartbeatTimeout... Changing the timeout value indeed helped...
I find it strange that the problem didn't occur prior to 2.24.5, actually...
@travomic I just noticed my comment was not sent (tried that a week ago on my phone).
Setting the heartbeatTimeout option actually resolves the issue.
If you want you can close this issue and archive it for future reference since this is not something you can really do much about (browsers dropping sockets because of timeouts).
fixed in [email protected] :)
Most helpful comment
fixed in [email protected] :)