Skip to content

fix: close WebSocket on pagehide to support bfcache#162

Open
FeironoX5 wants to merge 2 commits intomasterfrom
fix/websocket-bfcache
Open

fix: close WebSocket on pagehide to support bfcache#162
FeironoX5 wants to merge 2 commits intomasterfrom
fix/websocket-bfcache

Conversation

@FeironoX5
Copy link

Original problem

Lighthouse was giving an exception "Pages with WebSocket cannot enter back/forward cache (bfcache)" because we were not closing socket on pagehide event.

PR Description

Solution from MDN reference was implemented. When reproducing notice that vite dev also opens a socket, so, instead use npx vite build with npx serve and import changing in index.html. pageshow event is ignored, because socket connection will be restored when send method will be called.

изображение

@FeironoX5 FeironoX5 requested a review from neSpecc February 13, 2026 14:59
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

Successfully merging this pull request may close these issues.

2 participants