Skip to content

Notifications: WebSocket connection blocks pages from back/forward cache (bfcache) eligibility #45149

Closed

Description

@westonruter

Impacted plugin

Jetpack

Quick summary

When the Notifications module is active, a WebSocket is open on every page when a user is logged-in and the Admin Bar is showing. As noted in the web.dev article on Back/forward cache, such WebSocket connections make pages ineligible for bfcache. This means that users cannot take advantage of instant back/forward navigations. This was previously in #44322.

When Jetpack's open WebSocket is on the page, the Back/forward cache panel in Chrome DevTools reports the following:

Image

This connection is opened via an iframe'd page located at https://public-api.wordpress.com/wp-admin/rest-proxy/?v=2.0

To fix this issue, the aforementioned article advises to Close open connections before the user navigates away.

Guidance, with code samples, was also recently added to MDN: Working with the bfcache.

Steps to reproduce

  1. Enable the Notifications module
  2. Navigate from the WP Admin dashboard to another admin screen, and then try navigating back.
  3. Notice that the navigation is not instant, even when you have the No-cache BFCache plugin active (soon to be renamed “Instant Back/Forward”). Confirm this via a bfcache test in Chrome DevTools.

Site owner impact

More than 60% of the total website/platform users

Severity

Minor

What other impact(s) does this issue have?

No revenue impact

If a workaround is available, please outline it here.

As advised in the FAQ for the No-cache BFCache plugin, a workaround is to just disable the Notifications module.

Platform (Simple and/or Atomic)

Self-hosted

Activity

  1. added theissue type on Sep 11, 2025
  2. added
    BugWhen a feature is broken and / or not performing as intended
    Needs triageTicket needs to be triaged
    on Sep 11, 2025
  3. self-assigned this
    on Nov 4, 2025
  4. haqadn commented on Nov 11, 2025

    @haqadn
    Contributor

    Thanks for the report @westonruter. It should be solved now.

  5. gilbertococchi commented on Nov 11, 2025

    @gilbertococchi

    Wow, this is great news, thanks @haqadn for fixing this!

  6. westonruter commented on Nov 11, 2025

    @westonruter
    ContributorAuthor

    This seems improved, but still not 100% resolved. I just tested from the WP Admin, and I'm getting about 50% success for bfcache:

    Screen.Recording.2025-11-11.at.09.28.08.mov
  7. reopened this on Nov 11, 2025
  8. haqadn commented on Nov 11, 2025

    @haqadn
    Contributor

    I've deployed another patch. Please let me know if you find anything else. @westonruter

  9. westonruter commented on Nov 12, 2025

    @westonruter
    ContributorAuthor

    @haqadn Success!

    Screen.Recording.2025-11-11.at.16.58.59.mov
  10. gilbertococchi commented on Nov 12, 2025

    @gilbertococchi

    BTW: @haqadn did also restart your WebSocket connection when pageshow with event.persisted=true triggers?

    This is important so a page restored from BFCache would restart the WebSocket connection otherwise the user will go back to a page with the connection closed.

  11. haqadn commented on Nov 12, 2025

    @haqadn
    Contributor

    BTW: @haqadn did also restart your WebSocket connection when pageshow with event.persisted=true triggers?

    This is important so a page restored from BFCache would restart the WebSocket connection otherwise the user will go back to a page with the connection closed.

    Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugWhen a feature is broken and / or not performing as intendedNeeds triageTicket needs to be triaged[Plugin] JetpackIssues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/[Pri] Normal[Status] Auto-allocated

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions